@@ -39,7 +39,9 @@ discard block |
||
| 39 | 39 | $action=GETPOST('action','alpha'); |
| 40 | 40 | |
| 41 | 41 | // Security check |
| 42 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 42 | +if ($user->societe_id) { |
|
| 43 | + $socid=$user->societe_id; |
|
| 44 | +} |
|
| 43 | 45 | $result = restrictedArea($user, 'societe', $id,''); |
| 44 | 46 | |
| 45 | 47 | $object = new Societe($db); |
@@ -66,15 +68,13 @@ discard block |
||
| 66 | 68 | { |
| 67 | 69 | header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); |
| 68 | 70 | exit; |
| 69 | - } |
|
| 70 | - else |
|
| 71 | + } else |
|
| 71 | 72 | { |
| 72 | 73 | if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') |
| 73 | 74 | { |
| 74 | 75 | $langs->load("errors"); |
| 75 | 76 | $mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; |
| 76 | - } |
|
| 77 | - else |
|
| 77 | + } else |
|
| 78 | 78 | { |
| 79 | 79 | $mesg = '<div class="error">'.$object->error.'</div>'; |
| 80 | 80 | } |
@@ -87,8 +87,7 @@ discard block |
||
| 87 | 87 | if ($object->fetch($id)) |
| 88 | 88 | { |
| 89 | 89 | $result=$object->swapContactStatus(GETPOST('ligne')); |
| 90 | - } |
|
| 91 | - else |
|
| 90 | + } else |
|
| 92 | 91 | { |
| 93 | 92 | dol_print_error($db); |
| 94 | 93 | } |
@@ -104,8 +103,7 @@ discard block |
||
| 104 | 103 | { |
| 105 | 104 | header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); |
| 106 | 105 | exit; |
| 107 | - } |
|
| 108 | - else { |
|
| 106 | + } else { |
|
| 109 | 107 | dol_print_error($db); |
| 110 | 108 | } |
| 111 | 109 | } |
@@ -171,17 +169,21 @@ discard block |
||
| 171 | 169 | print yn($object->fournisseur); |
| 172 | 170 | print '</td></tr>';*/ |
| 173 | 171 | |
| 174 | - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 172 | + if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 173 | + // Old not used prefix field |
|
| 175 | 174 | { |
| 176 | 175 | print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 177 | 176 | } |
| 177 | + } |
|
| 178 | 178 | |
| 179 | 179 | if ($object->client) |
| 180 | 180 | { |
| 181 | 181 | print '<tr><td class="titlefield">'; |
| 182 | 182 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
| 183 | 183 | print $object->code_client; |
| 184 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 184 | + if ($object->check_codeclient() <> 0) { |
|
| 185 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 186 | + } |
|
| 185 | 187 | print '</td></tr>'; |
| 186 | 188 | } |
| 187 | 189 | |
@@ -190,7 +192,9 @@ discard block |
||
| 190 | 192 | print '<tr><td class="titlefield">'; |
| 191 | 193 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
| 192 | 194 | print $object->code_fournisseur; |
| 193 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 195 | + if ($object->check_codefournisseur() <> 0) { |
|
| 196 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 197 | + } |
|
| 194 | 198 | print '</td></tr>'; |
| 195 | 199 | } |
| 196 | 200 | print '</table>'; |
@@ -205,7 +209,9 @@ discard block |
||
| 205 | 209 | foreach($dirtpls as $reldir) |
| 206 | 210 | { |
| 207 | 211 | $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); |
| 208 | - if ($res) break; |
|
| 212 | + if ($res) { |
|
| 213 | + break; |
|
| 214 | + } |
|
| 209 | 215 | } |
| 210 | 216 | |
| 211 | 217 | // additionnal list with adherents of company |
@@ -311,16 +317,16 @@ discard block |
||
| 311 | 317 | print " ".img_warning($langs->trans("SubscriptionLate")); |
| 312 | 318 | } |
| 313 | 319 | print '</td>'; |
| 314 | - } |
|
| 315 | - else |
|
| 320 | + } else |
|
| 316 | 321 | { |
| 317 | 322 | print '<td align="left" class="nowrap">'; |
| 318 | 323 | if ($objp->subscription == 'yes') |
| 319 | 324 | { |
| 320 | 325 | print $langs->trans("SubscriptionNotReceived"); |
| 321 | - if ($objp->statut > 0) print " ".img_warning(); |
|
| 322 | - } |
|
| 323 | - else |
|
| 326 | + if ($objp->statut > 0) { |
|
| 327 | + print " ".img_warning(); |
|
| 328 | + } |
|
| 329 | + } else |
|
| 324 | 330 | { |
| 325 | 331 | print ' '; |
| 326 | 332 | } |
@@ -334,8 +340,7 @@ discard block |
||
| 334 | 340 | } |
| 335 | 341 | } |
| 336 | 342 | } |
| 337 | - } |
|
| 338 | - else |
|
| 343 | + } else |
|
| 339 | 344 | { |
| 340 | 345 | // Contrat non trouve |
| 341 | 346 | print "ErrorRecordNotFound"; |
@@ -35,7 +35,9 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // Security check |
| 37 | 37 | $socid = GETPOST('socid','int'); |
| 38 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 38 | +if ($user->societe_id) { |
|
| 39 | + $socid=$user->societe_id; |
|
| 40 | +} |
|
| 39 | 41 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
| 40 | 42 | |
| 41 | 43 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
@@ -48,7 +50,9 @@ discard block |
||
| 48 | 50 | |
| 49 | 51 | $parameters=array('id'=>$socid); |
| 50 | 52 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
| 51 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 53 | +if ($reshook < 0) { |
|
| 54 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 55 | +} |
|
| 52 | 56 | |
| 53 | 57 | |
| 54 | 58 | |
@@ -72,10 +76,14 @@ discard block |
||
| 72 | 76 | $result = $object->fetch($socid); |
| 73 | 77 | |
| 74 | 78 | $title=$langs->trans("Projects"); |
| 75 | - if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; |
|
| 79 | + if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
| 80 | + $title=$object->name." - ".$title; |
|
| 81 | + } |
|
| 76 | 82 | llxHeader('',$title); |
| 77 | 83 | |
| 78 | - if (! empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 84 | + if (! empty($conf->notification->enabled)) { |
|
| 85 | + $langs->load("mails"); |
|
| 86 | + } |
|
| 79 | 87 | $head = societe_prepare_head($object); |
| 80 | 88 | |
| 81 | 89 | dol_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company'); |
@@ -89,17 +97,21 @@ discard block |
||
| 89 | 97 | print '<div class="underbanner clearboth"></div>'; |
| 90 | 98 | print '<table class="border centpercent">'; |
| 91 | 99 | |
| 92 | - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 100 | + if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 101 | + // Old not used prefix field |
|
| 93 | 102 | { |
| 94 | 103 | print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 95 | 104 | } |
| 105 | + } |
|
| 96 | 106 | |
| 97 | 107 | if ($object->client) |
| 98 | 108 | { |
| 99 | 109 | print '<tr><td class="titlefield">'; |
| 100 | 110 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
| 101 | 111 | print $object->code_client; |
| 102 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 112 | + if ($object->check_codeclient() <> 0) { |
|
| 113 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 114 | + } |
|
| 103 | 115 | print '</td></tr>'; |
| 104 | 116 | } |
| 105 | 117 | |
@@ -108,7 +120,9 @@ discard block |
||
| 108 | 120 | print '<tr><td class="titlefield">'; |
| 109 | 121 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
| 110 | 122 | print $object->code_fournisseur; |
| 111 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 123 | + if ($object->check_codefournisseur() <> 0) { |
|
| 124 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 125 | + } |
|
| 112 | 126 | print '</td></tr>'; |
| 113 | 127 | } |
| 114 | 128 | |
@@ -38,15 +38,21 @@ discard block |
||
| 38 | 38 | $actionid=GETPOST('actionid'); |
| 39 | 39 | |
| 40 | 40 | // Security check |
| 41 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 41 | +if ($user->societe_id) { |
|
| 42 | + $socid=$user->societe_id; |
|
| 43 | +} |
|
| 42 | 44 | $result = restrictedArea($user, 'societe','',''); |
| 43 | 45 | |
| 44 | 46 | $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
| 45 | 47 | $sortfield=GETPOST("sortfield",'alpha'); |
| 46 | 48 | $sortorder=GETPOST("sortorder",'alpha'); |
| 47 | 49 | $page=GETPOST("page",'int'); |
| 48 | -if (! $sortorder) $sortorder="DESC"; |
|
| 49 | -if (! $sortfield) $sortfield="n.daten"; |
|
| 50 | +if (! $sortorder) { |
|
| 51 | + $sortorder="DESC"; |
|
| 52 | +} |
|
| 53 | +if (! $sortfield) { |
|
| 54 | + $sortfield="n.daten"; |
|
| 55 | +} |
|
| 50 | 56 | if (empty($page) || $page == -1) { $page = 0; } |
| 51 | 57 | $offset = $limit * $page; |
| 52 | 58 | $pageprev = $page - 1; |
@@ -67,7 +73,9 @@ discard block |
||
| 67 | 73 | |
| 68 | 74 | $parameters=array('id'=>$socid); |
| 69 | 75 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
| 70 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 76 | +if ($reshook < 0) { |
|
| 77 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 78 | +} |
|
| 71 | 79 | |
| 72 | 80 | if (empty($reshook)) |
| 73 | 81 | { |
@@ -103,8 +111,7 @@ discard block |
||
| 103 | 111 | $error++; |
| 104 | 112 | dol_print_error($db); |
| 105 | 113 | } |
| 106 | - } |
|
| 107 | - else |
|
| 114 | + } else |
|
| 108 | 115 | { |
| 109 | 116 | dol_print_error($db); |
| 110 | 117 | } |
@@ -112,8 +119,7 @@ discard block |
||
| 112 | 119 | if (! $error) |
| 113 | 120 | { |
| 114 | 121 | $db->commit(); |
| 115 | - } |
|
| 116 | - else |
|
| 122 | + } else |
|
| 117 | 123 | { |
| 118 | 124 | $db->rollback(); |
| 119 | 125 | } |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | $result=$object->fetch($socid); |
| 141 | 147 | |
| 142 | 148 | $title=$langs->trans("ThirdParty").' - '.$langs->trans("Notification"); |
| 143 | -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Notification"); |
|
| 149 | +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
| 150 | + $title=$object->name.' - '.$langs->trans("Notification"); |
|
| 151 | +} |
|
| 144 | 152 | $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
| 145 | 153 | llxHeader('',$title,$help_url); |
| 146 | 154 | |
@@ -163,17 +171,21 @@ discard block |
||
| 163 | 171 | print '<table class="border centpercent">'; |
| 164 | 172 | |
| 165 | 173 | // Prefix |
| 166 | - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 174 | + if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 175 | + // Old not used prefix field |
|
| 167 | 176 | { |
| 168 | 177 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 169 | 178 | } |
| 179 | + } |
|
| 170 | 180 | |
| 171 | 181 | if ($object->client) |
| 172 | 182 | { |
| 173 | 183 | print '<tr><td class="titlefield">'; |
| 174 | 184 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
| 175 | 185 | print $object->code_client; |
| 176 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 186 | + if ($object->check_codeclient() <> 0) { |
|
| 187 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 188 | + } |
|
| 177 | 189 | print '</td></tr>'; |
| 178 | 190 | } |
| 179 | 191 | |
@@ -182,7 +194,9 @@ discard block |
||
| 182 | 194 | print '<tr><td class="titlefield">'; |
| 183 | 195 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
| 184 | 196 | print $object->code_fournisseur; |
| 185 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 197 | + if ($object->check_codefournisseur() <> 0) { |
|
| 198 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 199 | + } |
|
| 186 | 200 | print '</td></tr>'; |
| 187 | 201 | } |
| 188 | 202 | |
@@ -262,8 +276,7 @@ discard block |
||
| 262 | 276 | print '</td>'; |
| 263 | 277 | print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>'; |
| 264 | 278 | print '</tr>'; |
| 265 | - } |
|
| 266 | - else |
|
| 279 | + } else |
|
| 267 | 280 | { |
| 268 | 281 | print '<tr class="oddeven"><td colspan="4" class="opacitymedium">'; |
| 269 | 282 | print $langs->trans("YouMustCreateContactFirst"); |
@@ -292,8 +305,7 @@ discard block |
||
| 292 | 305 | if ($resql) |
| 293 | 306 | { |
| 294 | 307 | $num = $db->num_rows($resql); |
| 295 | - } |
|
| 296 | - else |
|
| 308 | + } else |
|
| 297 | 309 | { |
| 298 | 310 | dol_print_error($db); |
| 299 | 311 | } |
@@ -332,8 +344,7 @@ discard block |
||
| 332 | 344 | if (isValidEmail($obj->email)) |
| 333 | 345 | { |
| 334 | 346 | print ' <'.$obj->email.'>'; |
| 335 | - } |
|
| 336 | - else |
|
| 347 | + } else |
|
| 337 | 348 | { |
| 338 | 349 | $langs->load("errors"); |
| 339 | 350 | print ' '.img_warning().' '.$langs->trans("ErrorBadEMail",$obj->email); |
@@ -345,8 +356,12 @@ discard block |
||
| 345 | 356 | print $label; |
| 346 | 357 | print '</td>'; |
| 347 | 358 | print '<td>'; |
| 348 | - if ($obj->type == 'email') print $langs->trans("Email"); |
|
| 349 | - if ($obj->type == 'sms') print $langs->trans("SMS"); |
|
| 359 | + if ($obj->type == 'email') { |
|
| 360 | + print $langs->trans("Email"); |
|
| 361 | + } |
|
| 362 | + if ($obj->type == 'sms') { |
|
| 363 | + print $langs->trans("SMS"); |
|
| 364 | + } |
|
| 350 | 365 | print '</td>'; |
| 351 | 366 | print '<td align="right"><a href="card.php?socid='.$socid.'&action=delete&actid='.$obj->rowid.'">'.img_delete().'</a></td>'; |
| 352 | 367 | print '</tr>'; |
@@ -429,9 +444,11 @@ discard block |
||
| 429 | 444 | { |
| 430 | 445 | $result = $db->query($sql); |
| 431 | 446 | $nbtotalofrecords = $db->num_rows($result); |
| 432 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 447 | + if (($page * $limit) > $nbtotalofrecords) { |
|
| 448 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 433 | 449 | { |
| 434 | 450 | $page = 0; |
| 451 | + } |
|
| 435 | 452 | $offset = 0; |
| 436 | 453 | } |
| 437 | 454 | } |
@@ -442,18 +459,23 @@ discard block |
||
| 442 | 459 | if ($resql) |
| 443 | 460 | { |
| 444 | 461 | $num = $db->num_rows($resql); |
| 445 | - } |
|
| 446 | - else |
|
| 462 | + } else |
|
| 447 | 463 | { |
| 448 | 464 | dol_print_error($db); |
| 449 | 465 | } |
| 450 | 466 | |
| 451 | 467 | $param='&socid='.$object->id; |
| 452 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 453 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 468 | + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 469 | + $param.='&contextpage='.$contextpage; |
|
| 470 | + } |
|
| 471 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 472 | + $param.='&limit='.$limit; |
|
| 473 | + } |
|
| 454 | 474 | |
| 455 | 475 | print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">'; |
| 456 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 476 | + if ($optioncss != '') { |
|
| 477 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 478 | + } |
|
| 457 | 479 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 458 | 480 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
| 459 | 481 | print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
@@ -492,8 +514,7 @@ discard block |
||
| 492 | 514 | $contactstatic->firstname=$obj->firstname; |
| 493 | 515 | print $contactstatic->getNomUrl(1); |
| 494 | 516 | print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); |
| 495 | - } |
|
| 496 | - else |
|
| 517 | + } else |
|
| 497 | 518 | { |
| 498 | 519 | print $obj->email; |
| 499 | 520 | } |
@@ -503,8 +524,12 @@ discard block |
||
| 503 | 524 | print $label; |
| 504 | 525 | print '</td>'; |
| 505 | 526 | print '<td>'; |
| 506 | - if ($obj->type == 'email') print $langs->trans("Email"); |
|
| 507 | - if ($obj->type == 'sms') print $langs->trans("Sms"); |
|
| 527 | + if ($obj->type == 'email') { |
|
| 528 | + print $langs->trans("Email"); |
|
| 529 | + } |
|
| 530 | + if ($obj->type == 'sms') { |
|
| 531 | + print $langs->trans("Sms"); |
|
| 532 | + } |
|
| 508 | 533 | print '</td>'; |
| 509 | 534 | // TODO Add link to object here for other types |
| 510 | 535 | /*print '<td>'; |
@@ -526,8 +551,9 @@ discard block |
||
| 526 | 551 | print '</table>'; |
| 527 | 552 | |
| 528 | 553 | print '</form>'; |
| 554 | +} else { |
|
| 555 | + dol_print_error('','RecordNotFound'); |
|
| 529 | 556 | } |
| 530 | -else dol_print_error('','RecordNotFound'); |
|
| 531 | 557 | |
| 532 | 558 | // End of page |
| 533 | 559 | llxFooter(); |
@@ -64,7 +64,9 @@ discard block |
||
| 64 | 64 | $sql.= " AND a.rowid = n.fk_action"; |
| 65 | 65 | $sql.= " AND n.fk_soc = s.rowid"; |
| 66 | 66 | $sql.= " AND s.entity IN (".getEntity('societe').")"; |
| 67 | -if ($socid > 0) $sql.= " AND s.rowid = " . $user->societe_id; |
|
| 67 | +if ($socid > 0) { |
|
| 68 | + $sql.= " AND s.rowid = " . $user->societe_id; |
|
| 69 | +} |
|
| 68 | 70 | |
| 69 | 71 | $sql.= $db->order($sortfield,$sortorder); |
| 70 | 72 | $sql.= $db->plimit($conf->liste_limit, $offset); |
@@ -98,8 +100,7 @@ discard block |
||
| 98 | 100 | } |
| 99 | 101 | print "</table>"; |
| 100 | 102 | $db->free(); |
| 101 | -} |
|
| 102 | -else |
|
| 103 | +} else |
|
| 103 | 104 | { |
| 104 | 105 | dol_print_error($db); |
| 105 | 106 | } |
@@ -46,7 +46,8 @@ |
||
| 46 | 46 | print $userstatic->getNomUrl(-1); |
| 47 | 47 | print ' '; |
| 48 | 48 | } |
| 49 | +} else { |
|
| 50 | + print '<span class="opacitymedium">'.$langs->trans("NoSalesRepresentativeAffected").'</span>'; |
|
| 49 | 51 | } |
| 50 | -else print '<span class="opacitymedium">'.$langs->trans("NoSalesRepresentativeAffected").'</span>'; |
|
| 51 | 52 | print '</td></tr>'; |
| 52 | 53 | |
@@ -33,10 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // Security check |
| 35 | 35 | $socid = GETPOST('socid','int'); |
| 36 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 36 | +if ($user->societe_id) { |
|
| 37 | + $socid=$user->societe_id; |
|
| 38 | +} |
|
| 37 | 39 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
| 38 | 40 | $object = new Societe($db); |
| 39 | -if ($socid > 0) $object->fetch($socid); |
|
| 41 | +if ($socid > 0) { |
|
| 42 | + $object->fetch($socid); |
|
| 43 | +} |
|
| 40 | 44 | |
| 41 | 45 | // Sort & Order fields |
| 42 | 46 | $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
@@ -47,8 +51,12 @@ discard block |
||
| 47 | 51 | $offset = $limit * $page; |
| 48 | 52 | $pageprev = $page - 1; |
| 49 | 53 | $pagenext = $page + 1; |
| 50 | -if (! $sortorder) $sortorder='DESC'; |
|
| 51 | -if (! $sortfield) $sortfield='dateprint'; |
|
| 54 | +if (! $sortorder) { |
|
| 55 | + $sortorder='DESC'; |
|
| 56 | +} |
|
| 57 | +if (! $sortfield) { |
|
| 58 | + $sortfield='dateprint'; |
|
| 59 | +} |
|
| 52 | 60 | |
| 53 | 61 | // Search fields |
| 54 | 62 | $sref=GETPOST("sref"); |
@@ -57,9 +65,11 @@ discard block |
||
| 57 | 65 | $year = GETPOST('year','int'); |
| 58 | 66 | |
| 59 | 67 | // Clean up on purge search criteria ? |
| 60 | -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers |
|
| 68 | +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) { |
|
| 69 | + // Both test are required to be compatible with all browsers |
|
| 61 | 70 | { |
| 62 | 71 | $sref=''; |
| 72 | +} |
|
| 63 | 73 | $sprod_fulldescr=''; |
| 64 | 74 | $year=''; |
| 65 | 75 | $month=''; |
@@ -81,7 +91,9 @@ discard block |
||
| 81 | 91 | |
| 82 | 92 | $parameters=array('id'=>$socid); |
| 83 | 93 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
| 84 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 94 | +if ($reshook < 0) { |
|
| 95 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 96 | +} |
|
| 85 | 97 | |
| 86 | 98 | |
| 87 | 99 | |
@@ -94,7 +106,9 @@ discard block |
||
| 94 | 106 | $productstatic=new Product($db); |
| 95 | 107 | |
| 96 | 108 | $title = $langs->trans("Referers",$object->name); |
| 97 | -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; |
|
| 109 | +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
| 110 | + $title=$object->name." - ".$title; |
|
| 111 | +} |
|
| 98 | 112 | $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
| 99 | 113 | llxHeader('',$title,$help_url); |
| 100 | 114 | |
@@ -116,10 +130,12 @@ discard block |
||
| 116 | 130 | print '<div class="underbanner clearboth"></div>'; |
| 117 | 131 | print '<table class="border" width="100%">'; |
| 118 | 132 | |
| 119 | -if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 133 | +if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 134 | + // Old not used prefix field |
|
| 120 | 135 | { |
| 121 | 136 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 122 | 137 | } |
| 138 | +} |
|
| 123 | 139 | |
| 124 | 140 | //if ($conf->agenda->enabled && $user->rights->agenda->myactions->read) $elementTypeArray['action']=$langs->transnoentitiesnoconv('Events'); |
| 125 | 141 | |
@@ -128,41 +144,65 @@ discard block |
||
| 128 | 144 | print '<tr><td class="titlefield">'; |
| 129 | 145 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
| 130 | 146 | print $object->code_client; |
| 131 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 147 | + if ($object->check_codeclient() <> 0) { |
|
| 148 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 149 | + } |
|
| 132 | 150 | print '</td></tr>'; |
| 133 | 151 | $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; |
| 134 | 152 | $resql=$db->query($sql); |
| 135 | - if (!$resql) dol_print_error($db); |
|
| 153 | + if (!$resql) { |
|
| 154 | + dol_print_error($db); |
|
| 155 | + } |
|
| 136 | 156 | |
| 137 | 157 | $obj = $db->fetch_object($resql); |
| 138 | 158 | $nbFactsClient = $obj->nb; |
| 139 | 159 | $thirdTypeArray['customer']=$langs->trans("customer"); |
| 140 | - if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); |
|
| 141 | - if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); |
|
| 142 | - if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); |
|
| 143 | - if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); |
|
| 144 | -} |
|
| 160 | + if ($conf->propal->enabled && $user->rights->propal->lire) { |
|
| 161 | + $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); |
|
| 162 | + } |
|
| 163 | + if ($conf->commande->enabled && $user->rights->commande->lire) { |
|
| 164 | + $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); |
|
| 165 | + } |
|
| 166 | + if ($conf->facture->enabled && $user->rights->facture->lire) { |
|
| 167 | + $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); |
|
| 168 | + } |
|
| 169 | + if ($conf->contrat->enabled && $user->rights->contrat->lire) { |
|
| 170 | + $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); |
|
| 171 | + } |
|
| 172 | + } |
|
| 145 | 173 | |
| 146 | -if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); |
|
| 174 | +if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) { |
|
| 175 | + $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); |
|
| 176 | +} |
|
| 147 | 177 | |
| 148 | 178 | if ($object->fournisseur) |
| 149 | 179 | { |
| 150 | 180 | print '<tr><td class="titlefield">'; |
| 151 | 181 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
| 152 | 182 | print $object->code_fournisseur; |
| 153 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 183 | + if ($object->check_codefournisseur() <> 0) { |
|
| 184 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 185 | + } |
|
| 154 | 186 | print '</td></tr>'; |
| 155 | 187 | $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; |
| 156 | 188 | $resql=$db->query($sql); |
| 157 | - if (!$resql) dol_print_error($db); |
|
| 189 | + if (!$resql) { |
|
| 190 | + dol_print_error($db); |
|
| 191 | + } |
|
| 158 | 192 | |
| 159 | 193 | $obj = $db->fetch_object($resql); |
| 160 | 194 | $nbCmdsFourn = $obj->nb; |
| 161 | 195 | $thirdTypeArray['supplier']=$langs->trans("supplier"); |
| 162 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 163 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 164 | - if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 165 | -} |
|
| 196 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) { |
|
| 197 | + $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 198 | + } |
|
| 199 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) { |
|
| 200 | + $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 201 | + } |
|
| 202 | + if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) { |
|
| 203 | + $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 204 | + } |
|
| 205 | + } |
|
| 166 | 206 | print '</table>'; |
| 167 | 207 | |
| 168 | 208 | print '</div>'; |
@@ -296,14 +336,26 @@ discard block |
||
| 296 | 336 | { |
| 297 | 337 | $sql = $sql_select; |
| 298 | 338 | $sql.= ' d.description as description,'; |
| 299 | - if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 300 | - if ($type_element == 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 301 | - if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 302 | - if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 339 | + if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') { |
|
| 340 | + $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 341 | + } |
|
| 342 | + if ($type_element == 'supplier_proposal') { |
|
| 343 | + $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 344 | + } |
|
| 345 | + if ($type_element == 'contract') { |
|
| 346 | + $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 347 | + } |
|
| 348 | + if ($type_element != 'fichinter') { |
|
| 349 | + $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 350 | + } |
|
| 303 | 351 | $sql.= " s.rowid as socid "; |
| 304 | - if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; |
|
| 352 | + if ($type_element != 'fichinter') { |
|
| 353 | + $sql.= ", p.ref as prod_ref, p.label as product_label"; |
|
| 354 | + } |
|
| 305 | 355 | $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; |
| 306 | - if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 356 | + if ($type_element != 'fichinter') { |
|
| 357 | + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 358 | + } |
|
| 307 | 359 | $sql.= $where; |
| 308 | 360 | if ($month > 0) { |
| 309 | 361 | if ($year > 0) { |
@@ -318,12 +370,18 @@ discard block |
||
| 318 | 370 | $end = dol_time_plus_duree($start,1,'y') - 1; |
| 319 | 371 | $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
| 320 | 372 | } |
| 321 | - if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 373 | + if ($sref) { |
|
| 374 | + $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 375 | + } |
|
| 322 | 376 | if ($sprod_fulldescr) |
| 323 | 377 | { |
| 324 | 378 | $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
| 325 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 326 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 379 | + if (GETPOST('type_element') != 'fichinter') { |
|
| 380 | + $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 381 | + } |
|
| 382 | + if (GETPOST('type_element') != 'fichinter') { |
|
| 383 | + $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 384 | + } |
|
| 327 | 385 | $sql.=")"; |
| 328 | 386 | } |
| 329 | 387 | $sql.= $db->order($sortfield,$sortorder); |
@@ -360,18 +418,34 @@ discard block |
||
| 360 | 418 | if ($sql_select) |
| 361 | 419 | { |
| 362 | 420 | $resql=$db->query($sql); |
| 363 | - if (!$resql) dol_print_error($db); |
|
| 421 | + if (!$resql) { |
|
| 422 | + dol_print_error($db); |
|
| 423 | + } |
|
| 364 | 424 | |
| 365 | 425 | $num = $db->num_rows($resql); |
| 366 | 426 | |
| 367 | 427 | $param="&socid=".$socid."&type_element=".$type_element; |
| 368 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 369 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 370 | - if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 371 | - if ($sref) $param.= "&sref=".urlencode($sref); |
|
| 372 | - if ($month) $param.= "&month=".$month; |
|
| 373 | - if ($year) $param.= "&year=".$year; |
|
| 374 | - if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 428 | + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 429 | + $param.='&contextpage='.$contextpage; |
|
| 430 | + } |
|
| 431 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 432 | + $param.='&limit='.$limit; |
|
| 433 | + } |
|
| 434 | + if ($sprod_fulldescr) { |
|
| 435 | + $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 436 | + } |
|
| 437 | + if ($sref) { |
|
| 438 | + $param.= "&sref=".urlencode($sref); |
|
| 439 | + } |
|
| 440 | + if ($month) { |
|
| 441 | + $param.= "&month=".$month; |
|
| 442 | + } |
|
| 443 | + if ($year) { |
|
| 444 | + $param.= "&year=".$year; |
|
| 445 | + } |
|
| 446 | + if ($optioncss != '') { |
|
| 447 | + $param.='&optioncss='.$optioncss; |
|
| 448 | + } |
|
| 375 | 449 | |
| 376 | 450 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit); |
| 377 | 451 | |
@@ -426,7 +500,9 @@ discard block |
||
| 426 | 500 | $documentstatic->status=$objp->status; |
| 427 | 501 | $documentstatic->paye=$objp->paid; |
| 428 | 502 | |
| 429 | - if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; |
|
| 503 | + if (is_object($documentstaticline)) { |
|
| 504 | + $documentstaticline->statut=$objp->status; |
|
| 505 | + } |
|
| 430 | 506 | |
| 431 | 507 | print '<tr class="oddeven">'; |
| 432 | 508 | print '<td class="nobordernopadding nowrap" width="100">'; |
@@ -439,8 +515,7 @@ discard block |
||
| 439 | 515 | if ($type_element == 'contract') |
| 440 | 516 | { |
| 441 | 517 | print $documentstaticline->getLibStatut(2); |
| 442 | - } |
|
| 443 | - else |
|
| 518 | + } else |
|
| 444 | 519 | { |
| 445 | 520 | print $documentstatic->getLibStatut(2); |
| 446 | 521 | } |
@@ -474,8 +549,12 @@ discard block |
||
| 474 | 549 | |
| 475 | 550 | $outputlangs = $langs; |
| 476 | 551 | $newlang=''; |
| 477 | - if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); |
|
| 478 | - if (empty($newlang)) $newlang=$object->default_lang; |
|
| 552 | + if (empty($newlang) && GETPOST('lang_id','aZ09')) { |
|
| 553 | + $newlang=GETPOST('lang_id','aZ09'); |
|
| 554 | + } |
|
| 555 | + if (empty($newlang)) { |
|
| 556 | + $newlang=$object->default_lang; |
|
| 557 | + } |
|
| 479 | 558 | if (! empty($newlang)) |
| 480 | 559 | { |
| 481 | 560 | $outputlangs = new Translate("",$conf); |
@@ -483,8 +562,7 @@ discard block |
||
| 483 | 562 | } |
| 484 | 563 | |
| 485 | 564 | $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
| 486 | - } |
|
| 487 | - else |
|
| 565 | + } else |
|
| 488 | 566 | { |
| 489 | 567 | $label = $objp->product_label; |
| 490 | 568 | } |
@@ -498,9 +576,13 @@ discard block |
||
| 498 | 576 | <?php |
| 499 | 577 | $txt=''; |
| 500 | 578 | print img_object($langs->trans("ShowReduc"),'reduc').' '; |
| 501 | - if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); |
|
| 502 | - elseif ($objp->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); |
|
| 503 | - elseif ($objp->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); |
|
| 579 | + if ($objp->description == '(DEPOSIT)') { |
|
| 580 | + $txt=$langs->trans("Deposit"); |
|
| 581 | + } elseif ($objp->description == '(EXCESS RECEIVED)') { |
|
| 582 | + $txt=$langs->trans("ExcessReceived"); |
|
| 583 | + } elseif ($objp->description == '(EXCESS PAID)') { |
|
| 584 | + $txt=$langs->trans("ExcessPaid"); |
|
| 585 | + } |
|
| 504 | 586 | //else $txt=$langs->trans("Discount"); |
| 505 | 587 | print $txt; |
| 506 | 588 | ?> |
@@ -519,28 +601,26 @@ discard block |
||
| 519 | 601 | $discount=new DiscountAbsolute($db); |
| 520 | 602 | $discount->fetch($objp->fk_remise_except); |
| 521 | 603 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0)); |
| 522 | - } |
|
| 523 | - elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
| 604 | + } elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
| 524 | 605 | { |
| 525 | 606 | $discount=new DiscountAbsolute($db); |
| 526 | 607 | $discount->fetch($objp->fk_remise_except); |
| 527 | 608 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0)); |
| 528 | - } |
|
| 529 | - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) |
|
| 609 | + } elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) |
|
| 530 | 610 | { |
| 531 | 611 | $discount=new DiscountAbsolute($db); |
| 532 | 612 | $discount->fetch($objp->fk_remise_except); |
| 533 | 613 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); |
| 534 | 614 | // Add date of deposit |
| 535 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; |
|
| 536 | - } |
|
| 537 | - else |
|
| 615 | + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) { |
|
| 616 | + echo ' ('.dol_print_date($discount->datec).')'; |
|
| 617 | + } |
|
| 618 | + } else |
|
| 538 | 619 | { |
| 539 | 620 | echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); |
| 540 | 621 | } |
| 541 | 622 | } |
| 542 | - } |
|
| 543 | - else |
|
| 623 | + } else |
|
| 544 | 624 | { |
| 545 | 625 | if ($objp->fk_product > 0) { |
| 546 | 626 | |
@@ -558,8 +638,11 @@ discard block |
||
| 558 | 638 | |
| 559 | 639 | if (! empty($objp->label) || ! empty($objp->description)) |
| 560 | 640 | { |
| 561 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
| 562 | - else $text = img_object($langs->trans('Product'),'product'); |
|
| 641 | + if ($type==1) { |
|
| 642 | + $text = img_object($langs->trans('Service'),'service'); |
|
| 643 | + } else { |
|
| 644 | + $text = img_object($langs->trans('Product'),'product'); |
|
| 645 | + } |
|
| 563 | 646 | |
| 564 | 647 | if (! empty($objp->label)) { |
| 565 | 648 | $text.= ' <strong>'.$objp->label.'</strong>'; |
@@ -621,8 +704,7 @@ discard block |
||
| 621 | 704 | print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); |
| 622 | 705 | } |
| 623 | 706 | $db->free($resql); |
| 624 | -} |
|
| 625 | -else if (empty($type_element) || $type_element == -1) |
|
| 707 | +} else if (empty($type_element) || $type_element == -1) |
|
| 626 | 708 | { |
| 627 | 709 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); |
| 628 | 710 | |
@@ -639,8 +721,7 @@ discard block |
||
| 639 | 721 | print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'</td></tr>'; |
| 640 | 722 | |
| 641 | 723 | print "</table>"; |
| 642 | -} |
|
| 643 | -else { |
|
| 724 | +} else { |
|
| 644 | 725 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); |
| 645 | 726 | |
| 646 | 727 | print '<table class="liste" width="100%">'."\n"; |
@@ -55,8 +55,12 @@ discard block |
||
| 55 | 55 | $offset = $conf->liste_limit * $page; |
| 56 | 56 | $pageprev = $page - 1; |
| 57 | 57 | $pagenext = $page + 1; |
| 58 | -if (! $sortorder) $sortorder="ASC"; |
|
| 59 | -if (! $sortfield) $sortfield="position_name"; |
|
| 58 | +if (! $sortorder) { |
|
| 59 | + $sortorder="ASC"; |
|
| 60 | +} |
|
| 61 | +if (! $sortfield) { |
|
| 62 | + $sortfield="position_name"; |
|
| 63 | +} |
|
| 60 | 64 | |
| 61 | 65 | $object = new Societe($db); |
| 62 | 66 | if ($id > 0 || ! empty($ref)) |
@@ -86,7 +90,9 @@ discard block |
||
| 86 | 90 | $form = new Form($db); |
| 87 | 91 | |
| 88 | 92 | $title=$langs->trans("ThirdParty").' - '.$langs->trans("Files"); |
| 89 | -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files"); |
|
| 93 | +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
| 94 | + $title=$object->name.' - '.$langs->trans("Files"); |
|
| 95 | +} |
|
| 90 | 96 | $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
| 91 | 97 | llxHeader('',$title,$help_url); |
| 92 | 98 | |
@@ -95,7 +101,9 @@ discard block |
||
| 95 | 101 | /* |
| 96 | 102 | * Show tabs |
| 97 | 103 | */ |
| 98 | - if (! empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 104 | + if (! empty($conf->notification->enabled)) { |
|
| 105 | + $langs->load("mails"); |
|
| 106 | + } |
|
| 99 | 107 | $head = societe_prepare_head($object); |
| 100 | 108 | |
| 101 | 109 | $form=new Form($db); |
@@ -121,17 +129,21 @@ discard block |
||
| 121 | 129 | print '<table class="border centpercent">'; |
| 122 | 130 | |
| 123 | 131 | // Prefix |
| 124 | - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 132 | + if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 133 | + // Old not used prefix field |
|
| 125 | 134 | { |
| 126 | 135 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 127 | 136 | } |
| 137 | + } |
|
| 128 | 138 | |
| 129 | 139 | if ($object->client) |
| 130 | 140 | { |
| 131 | 141 | print '<tr><td class="titlefield">'; |
| 132 | 142 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
| 133 | 143 | print $object->code_client; |
| 134 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 144 | + if ($object->check_codeclient() <> 0) { |
|
| 145 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 146 | + } |
|
| 135 | 147 | print '</td></tr>'; |
| 136 | 148 | } |
| 137 | 149 | |
@@ -140,7 +152,9 @@ discard block |
||
| 140 | 152 | print '<tr><td class="titlefield">'; |
| 141 | 153 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
| 142 | 154 | print $object->code_fournisseur; |
| 143 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 155 | + if ($object->check_codefournisseur() <> 0) { |
|
| 156 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 157 | + } |
|
| 144 | 158 | print '</td></tr>'; |
| 145 | 159 | } |
| 146 | 160 | |
@@ -161,8 +175,7 @@ discard block |
||
| 161 | 175 | $permtoedit = $user->rights->societe->creer; |
| 162 | 176 | $param = '&id=' . $object->id; |
| 163 | 177 | include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
| 164 | -} |
|
| 165 | -else |
|
| 178 | +} else |
|
| 166 | 179 | { |
| 167 | 180 | accessforbidden('',0,0); |
| 168 | 181 | } |
@@ -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> |
@@ -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 } ?> |