@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | // $head[$tab][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id; |
| 74 | 74 | $head[$tab][0] = BASE_URI . '?controller=contact&method=note&id=' . $object->id; |
| 75 | 75 | $head[$tab][1] = $langs->trans("Note"); |
| 76 | - if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 76 | + if($nbNote > 0) { |
|
| 77 | + $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 78 | + } |
|
| 77 | 79 | $head[$tab][2] = 'note'; |
| 78 | 80 | $tab++; |
| 79 | 81 | } |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | // $head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id; |
| 87 | 89 | $head[$tab][0] = BASE_URI . '?controller=contact&method=document&id=' . $object->id; |
| 88 | 90 | $head[$tab][1] = $langs->trans("Documents"); |
| 89 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 91 | + if (($nbFiles+$nbLinks) > 0) { |
|
| 92 | + $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 93 | + } |
|
| 90 | 94 | $head[$tab][2] = 'documents'; |
| 91 | 95 | $tab++; |
| 92 | 96 | |
@@ -74,7 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | 76 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some |
| 77 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 77 | +if ($reshook < 0) { |
|
| 78 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 79 | +} |
|
| 78 | 80 | |
| 79 | 81 | if ($action == 'update') |
| 80 | 82 | { |
@@ -122,7 +124,9 @@ discard block |
||
| 122 | 124 | |
| 123 | 125 | // Fill array 'array_options' with data from add form |
| 124 | 126 | $ret = $extrafields->setOptionalsFromPost($extralabels,$object); |
| 125 | - if ($ret < 0) $error++; |
|
| 127 | + if ($ret < 0) { |
|
| 128 | + $error++; |
|
| 129 | + } |
|
| 126 | 130 | |
| 127 | 131 | if ($object->update($user) > 0) |
| 128 | 132 | { |
@@ -176,15 +180,16 @@ discard block |
||
| 176 | 180 | |
| 177 | 181 | // Fill array 'array_options' with data from add form |
| 178 | 182 | $ret = $extrafields->setOptionalsFromPost($extralabels,$object); |
| 179 | - if ($ret < 0) $error++; |
|
| 183 | + if ($ret < 0) { |
|
| 184 | + $error++; |
|
| 185 | + } |
|
| 180 | 186 | |
| 181 | 187 | $res = $object->create($user); |
| 182 | 188 | if ($res > 0) |
| 183 | 189 | { |
| 184 | 190 | header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res); |
| 185 | 191 | exit; |
| 186 | - } |
|
| 187 | - else |
|
| 192 | + } else |
|
| 188 | 193 | { |
| 189 | 194 | setEventMessages($object->error, $object->errors, 'errors'); |
| 190 | 195 | } |
@@ -198,8 +203,7 @@ discard block |
||
| 198 | 203 | { |
| 199 | 204 | header("Location: index.php"); |
| 200 | 205 | exit; |
| 201 | - } |
|
| 202 | - else |
|
| 206 | + } else |
|
| 203 | 207 | { |
| 204 | 208 | dol_syslog($object->error,LOG_DEBUG); |
| 205 | 209 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -214,8 +218,7 @@ discard block |
||
| 214 | 218 | |
| 215 | 219 | header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); |
| 216 | 220 | exit; |
| 217 | - } |
|
| 218 | - else { |
|
| 221 | + } else { |
|
| 219 | 222 | setEventMessages($object->error, $object->errors, 'errors'); |
| 220 | 223 | } |
| 221 | 224 | } |
@@ -226,8 +229,7 @@ discard block |
||
| 226 | 229 | { |
| 227 | 230 | header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); |
| 228 | 231 | exit; |
| 229 | - } |
|
| 230 | - else { |
|
| 232 | + } else { |
|
| 231 | 233 | setEventMessages($object->error, $object->errors, 'errors'); |
| 232 | 234 | } |
| 233 | 235 | } |
@@ -238,12 +240,10 @@ discard block |
||
| 238 | 240 | { |
| 239 | 241 | header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); |
| 240 | 242 | exit; |
| 241 | - } |
|
| 242 | - else { |
|
| 243 | + } else { |
|
| 243 | 244 | setEventMessages($object->error, $object->errors, 'errors'); |
| 244 | 245 | } |
| 245 | -} |
|
| 246 | -else if ($action == 'classin' && $user->rights->don->creer) |
|
| 246 | +} else if ($action == 'classin' && $user->rights->don->creer) |
|
| 247 | 247 | { |
| 248 | 248 | $object->fetch($id); |
| 249 | 249 | $object->setProject($projectid); |
@@ -351,13 +351,14 @@ discard block |
||
| 351 | 351 | print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); |
| 352 | 352 | if ($soc->outstanding_limit != '') |
| 353 | 353 | { |
| 354 | - if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); |
|
| 354 | + if ($outstandingBills > $soc->outstanding_limit) { |
|
| 355 | + print img_warning($langs->trans("OutstandingBillReached")); |
|
| 356 | + } |
|
| 355 | 357 | print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); |
| 356 | 358 | } |
| 357 | 359 | print ')'; |
| 358 | 360 | print '</td>'; |
| 359 | - } |
|
| 360 | - else |
|
| 361 | + } else |
|
| 361 | 362 | { |
| 362 | 363 | print '<td colspan="2">'; |
| 363 | 364 | print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); |
@@ -413,7 +414,9 @@ discard block |
||
| 413 | 414 | // Country |
| 414 | 415 | print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">'; |
| 415 | 416 | print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); |
| 416 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 417 | + if ($user->admin) { |
|
| 418 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 419 | + } |
|
| 417 | 420 | print '</td></tr>'; |
| 418 | 421 | |
| 419 | 422 | print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>'; |
@@ -522,8 +525,7 @@ discard block |
||
| 522 | 525 | if ($object->statut == 0) |
| 523 | 526 | { |
| 524 | 527 | print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>'; |
| 525 | - } |
|
| 526 | - else |
|
| 528 | + } else |
|
| 527 | 529 | { |
| 528 | 530 | print '<tr><td>'.$langs->trans("Amount").'</td><td>'; |
| 529 | 531 | print price($object->amount,0,$langs,0,0,-1,$conf->currency); |
@@ -552,15 +554,20 @@ discard block |
||
| 552 | 554 | // Country |
| 553 | 555 | print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>'; |
| 554 | 556 | print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); |
| 555 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 557 | + if ($user->admin) { |
|
| 558 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 559 | + } |
|
| 556 | 560 | print '</td></tr>'; |
| 557 | 561 | |
| 558 | 562 | print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>'; |
| 559 | 563 | |
| 560 | 564 | // Payment mode |
| 561 | 565 | print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n"; |
| 562 | - if ($object->modepaymentid) $selected = $object->modepaymentid; |
|
| 563 | - else $selected = ''; |
|
| 566 | + if ($object->modepaymentid) { |
|
| 567 | + $selected = $object->modepaymentid; |
|
| 568 | + } else { |
|
| 569 | + $selected = ''; |
|
| 570 | + } |
|
| 564 | 571 | $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1); |
| 565 | 572 | print "</td></tr>\n"; |
| 566 | 573 | |
@@ -640,8 +647,9 @@ discard block |
||
| 640 | 647 | $morehtmlref.=$langs->trans('Project') . ' '; |
| 641 | 648 | if ($user->rights->don->creer) |
| 642 | 649 | { |
| 643 | - if ($action != 'classify') |
|
| 644 | - $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 650 | + if ($action != 'classify') { |
|
| 651 | + $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 652 | + } |
|
| 645 | 653 | if ($action == 'classify') { |
| 646 | 654 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 647 | 655 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
@@ -766,8 +774,7 @@ discard block |
||
| 766 | 774 | } |
| 767 | 775 | print "</table>"; |
| 768 | 776 | $db->free($resql); |
| 769 | - } |
|
| 770 | - else |
|
| 777 | + } else |
|
| 771 | 778 | { |
| 772 | 779 | dol_print_error($db); |
| 773 | 780 | } |
@@ -804,8 +811,7 @@ discard block |
||
| 804 | 811 | if ($remaintopay == 0) |
| 805 | 812 | { |
| 806 | 813 | print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>'; |
| 807 | - } |
|
| 808 | - else |
|
| 814 | + } else |
|
| 809 | 815 | { |
| 810 | 816 | print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid=' . $object->id . '&action=create">' . $langs->trans('DoPayment') . '</a></div>'; |
| 811 | 817 | } |
@@ -823,13 +829,11 @@ discard block |
||
| 823 | 829 | if ($object->statut == -1 || $object->statut == 0) |
| 824 | 830 | { |
| 825 | 831 | print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>"; |
| 826 | - } |
|
| 827 | - else |
|
| 832 | + } else |
|
| 828 | 833 | { |
| 829 | 834 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>"; |
| 830 | 835 | } |
| 831 | - } |
|
| 832 | - else |
|
| 836 | + } else |
|
| 833 | 837 | { |
| 834 | 838 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>"; |
| 835 | 839 | } |
@@ -857,9 +861,11 @@ discard block |
||
| 857 | 861 | // Show online payment link |
| 858 | 862 | $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); |
| 859 | 863 | |
| 860 | - if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT && |
|
| 864 | + if ($useonlinepayment) { |
|
| 865 | + //$object->statut != Facture::STATUS_DRAFT && |
|
| 861 | 866 | { |
| 862 | 867 | print '<br><!-- Link to pay -->'."\n"; |
| 868 | + } |
|
| 863 | 869 | require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; |
| 864 | 870 | print showOnlinePaymentUrl('donation', $object->ref).'<br>'; |
| 865 | 871 | } |
@@ -47,7 +47,9 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // Security check |
| 49 | 49 | $socid=0; |
| 50 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 50 | +if ($user->societe_id) { |
|
| 51 | + $socid=$user->societe_id; |
|
| 52 | +} |
|
| 51 | 53 | $result=restrictedArea($user,'don',$id,''); |
| 52 | 54 | |
| 53 | 55 | $object = new Don($db); |
@@ -98,11 +100,12 @@ discard block |
||
| 98 | 100 | $morehtmlref.=$langs->trans('Project') . ' '; |
| 99 | 101 | if ($user->rights->don->creer) |
| 100 | 102 | { |
| 101 | - if ($action != 'classify') |
|
| 102 | - // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 103 | + if ($action != 'classify') { |
|
| 104 | + // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 103 | 105 | if ($action == 'classify') { |
| 104 | 106 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 105 | 107 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
| 108 | + } |
|
| 106 | 109 | $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
| 107 | 110 | $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 108 | 111 | $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
@@ -40,7 +40,9 @@ discard block |
||
| 40 | 40 | $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); |
| 41 | 41 | |
| 42 | 42 | // Security check |
| 43 | -if ($user->societe_id) $socid = $user->societe_id; |
|
| 43 | +if ($user->societe_id) { |
|
| 44 | + $socid = $user->societe_id; |
|
| 45 | +} |
|
| 44 | 46 | $result = restrictedArea($user, 'don', $id, ''); |
| 45 | 47 | |
| 46 | 48 | $object = new Don($db); |
@@ -80,11 +82,12 @@ discard block |
||
| 80 | 82 | $langs->load("projects"); |
| 81 | 83 | $morehtmlref .= $langs->trans('Project') . ' '; |
| 82 | 84 | if ($user->rights->don->creer) { |
| 83 | - if ($action != 'classify') |
|
| 84 | - // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 85 | + if ($action != 'classify') { |
|
| 86 | + // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 85 | 87 | if ($action == 'classify') { |
| 86 | 88 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 87 | 89 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
| 90 | + } |
|
| 88 | 91 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
| 89 | 92 | $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
| 90 | 93 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
@@ -54,7 +54,9 @@ discard block |
||
| 54 | 54 | $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); |
| 55 | 55 | |
| 56 | 56 | // Security check |
| 57 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 57 | +if ($user->societe_id) { |
|
| 58 | + $socid=$user->societe_id; |
|
| 59 | +} |
|
| 58 | 60 | $result = restrictedArea($user, 'don', $id, ''); |
| 59 | 61 | |
| 60 | 62 | |
@@ -66,8 +68,12 @@ discard block |
||
| 66 | 68 | $offset = $conf->liste_limit * $page; |
| 67 | 69 | $pageprev = $page - 1; |
| 68 | 70 | $pagenext = $page + 1; |
| 69 | -if (! $sortorder) $sortorder="ASC"; |
|
| 70 | -if (! $sortfield) $sortfield="name"; |
|
| 71 | +if (! $sortorder) { |
|
| 72 | + $sortorder="ASC"; |
|
| 73 | +} |
|
| 74 | +if (! $sortfield) { |
|
| 75 | + $sortfield="name"; |
|
| 76 | +} |
|
| 71 | 77 | |
| 72 | 78 | |
| 73 | 79 | $object = new Don($db); |
@@ -129,11 +135,12 @@ discard block |
||
| 129 | 135 | $morehtmlref.=$langs->trans('Project') . ' '; |
| 130 | 136 | if ($user->rights->don->creer) |
| 131 | 137 | { |
| 132 | - if ($action != 'classify') |
|
| 133 | - // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 138 | + if ($action != 'classify') { |
|
| 139 | + // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 134 | 140 | if ($action == 'classify') { |
| 135 | 141 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 136 | 142 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
| 143 | + } |
|
| 137 | 144 | $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
| 138 | 145 | $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 139 | 146 | $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
@@ -190,8 +197,7 @@ discard block |
||
| 190 | 197 | $permtoedit = $user->rights->don->creer; |
| 191 | 198 | $param = '&id=' . $object->id; |
| 192 | 199 | include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
| 193 | -} |
|
| 194 | -else |
|
| 200 | +} else |
|
| 195 | 201 | { |
| 196 | 202 | print $langs->trans("ErrorUnknown"); |
| 197 | 203 | } |
@@ -44,7 +44,9 @@ discard block |
||
| 44 | 44 | $action=GETPOST('action','alpha'); |
| 45 | 45 | |
| 46 | 46 | // Security check |
| 47 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 47 | +if ($user->societe_id) { |
|
| 48 | + $socid=$user->societe_id; |
|
| 49 | +} |
|
| 48 | 50 | $result = restrictedArea($user, 'propal', $id); |
| 49 | 51 | |
| 50 | 52 | $object = new Propal($db); |
@@ -58,8 +60,7 @@ discard block |
||
| 58 | 60 | $langs->load("errors"); |
| 59 | 61 | setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); |
| 60 | 62 | $error++; |
| 61 | - } |
|
| 62 | - else if ($ret < 0) |
|
| 63 | + } else if ($ret < 0) |
|
| 63 | 64 | { |
| 64 | 65 | setEventMessages($object->error, $object->errors, 'errors'); |
| 65 | 66 | $error++; |
@@ -68,8 +69,7 @@ discard block |
||
| 68 | 69 | if (! $error) |
| 69 | 70 | { |
| 70 | 71 | $object->fetch_thirdparty(); |
| 71 | -} |
|
| 72 | -else |
|
| 72 | +} else |
|
| 73 | 73 | { |
| 74 | 74 | header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); |
| 75 | 75 | exit; |
@@ -92,15 +92,13 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); |
| 94 | 94 | exit; |
| 95 | - } |
|
| 96 | - else |
|
| 95 | + } else |
|
| 97 | 96 | { |
| 98 | 97 | if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') |
| 99 | 98 | { |
| 100 | 99 | $langs->load("errors"); |
| 101 | 100 | setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); |
| 102 | - } |
|
| 103 | - else |
|
| 101 | + } else |
|
| 104 | 102 | { |
| 105 | 103 | setEventMessages($object->error, $object->errors, 'errors'); |
| 106 | 104 | } |
@@ -125,8 +123,7 @@ discard block |
||
| 125 | 123 | { |
| 126 | 124 | header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); |
| 127 | 125 | exit; |
| 128 | - } |
|
| 129 | - else |
|
| 126 | + } else |
|
| 130 | 127 | { |
| 131 | 128 | dol_print_error($db); |
| 132 | 129 | } |
@@ -173,9 +170,10 @@ discard block |
||
| 173 | 170 | $morehtmlref.='<br>'.$langs->trans('Project') . ' '; |
| 174 | 171 | if ($user->rights->propal->creer) |
| 175 | 172 | { |
| 176 | - if ($action != 'classify') |
|
| 177 | - //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; |
|
| 173 | + if ($action != 'classify') { |
|
| 174 | + //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; |
|
| 178 | 175 | $morehtmlref.=' : '; |
| 176 | + } |
|
| 179 | 177 | if ($action == 'classify') { |
| 180 | 178 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 181 | 179 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
@@ -212,7 +210,9 @@ discard block |
||
| 212 | 210 | foreach($dirtpls as $reldir) |
| 213 | 211 | { |
| 214 | 212 | $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); |
| 215 | - if ($res) break; |
|
| 213 | + if ($res) { |
|
| 214 | + break; |
|
| 215 | + } |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
@@ -38,7 +38,9 @@ discard block |
||
| 38 | 38 | // Load translation files required by the page |
| 39 | 39 | $langs->loadLangs(array('companies', 'products', 'admin', 'sms', 'other', 'errors')); |
| 40 | 40 | |
| 41 | -if (!$user->admin) accessforbidden(); |
|
| 41 | +if (!$user->admin) { |
|
| 42 | + accessforbidden(); |
|
| 43 | +} |
|
| 42 | 44 | |
| 43 | 45 | $id = GETPOST('rowid', 'int'); |
| 44 | 46 | $action = GETPOST('action', 'alpha'); |
@@ -55,8 +57,12 @@ discard block |
||
| 55 | 57 | $offset = $limit * $page; |
| 56 | 58 | $pageprev = $page - 1; |
| 57 | 59 | $pagenext = $page + 1; |
| 58 | -if (!$sortfield) $sortfield = 'page,param'; |
|
| 59 | -if (!$sortorder) $sortorder = 'ASC'; |
|
| 60 | +if (!$sortfield) { |
|
| 61 | + $sortfield = 'page,param'; |
|
| 62 | +} |
|
| 63 | +if (!$sortorder) { |
|
| 64 | + $sortorder = 'ASC'; |
|
| 65 | +} |
|
| 60 | 66 | |
| 61 | 67 | $defaulturl = GETPOST('defaulturl'); |
| 62 | 68 | $defaultkey = GETPOST('defaultkey', 'alpha'); |
@@ -86,14 +92,18 @@ discard block |
||
| 86 | 92 | |
| 87 | 93 | $parameters = array('socid' => $socid); |
| 88 | 94 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
| 89 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 95 | +if ($reshook < 0) { |
|
| 96 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 97 | +} |
|
| 90 | 98 | |
| 91 | 99 | include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
| 92 | 100 | |
| 93 | 101 | // Purge search criteria |
| 94 | -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 |
|
| 102 | +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
| 103 | + // All tests are required to be compatible with all browsers |
|
| 95 | 104 | { |
| 96 | 105 | $defaulturl = ''; |
| 106 | +} |
|
| 97 | 107 | $defaultkey = ''; |
| 98 | 108 | $defaultvalue = ''; |
| 99 | 109 | $toselect = ''; |
@@ -101,9 +111,12 @@ discard block |
||
| 101 | 111 | } |
| 102 | 112 | |
| 103 | 113 | if ($action == 'setMAIN_ENABLE_DEFAULT_VALUES') { |
| 104 | - if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity); |
|
| 105 | - else dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity); |
|
| 106 | -} |
|
| 114 | + if (GETPOST('value')) { |
|
| 115 | + dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity); |
|
| 116 | + } else { |
|
| 117 | + dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity); |
|
| 118 | + } |
|
| 119 | + } |
|
| 107 | 120 | |
| 108 | 121 | if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('actionmodify')) { |
| 109 | 122 | $error = 0; |
@@ -199,16 +212,30 @@ discard block |
||
| 199 | 212 | print $langs->trans("DefaultValuesDesc") . "<br>\n"; |
| 200 | 213 | print "<br>\n"; |
| 201 | 214 | |
| 202 | -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage=' . $contextpage; |
|
| 203 | -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit=' . $limit; |
|
| 204 | -if ($optioncss != '') $param .= '&optioncss=' . $optioncss; |
|
| 205 | -if ($defaulturl) $param .= '&defaulturl=' . urlencode($defaulturl); |
|
| 206 | -if ($defaultkey) $param .= '&defaultkey=' . urlencode($defaultkey); |
|
| 207 | -if ($defaultvalue) $param .= '&defaultvalue=' . urlencode($defaultvalue); |
|
| 215 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 216 | + $param .= '&contextpage=' . $contextpage; |
|
| 217 | +} |
|
| 218 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 219 | + $param .= '&limit=' . $limit; |
|
| 220 | +} |
|
| 221 | +if ($optioncss != '') { |
|
| 222 | + $param .= '&optioncss=' . $optioncss; |
|
| 223 | +} |
|
| 224 | +if ($defaulturl) { |
|
| 225 | + $param .= '&defaulturl=' . urlencode($defaulturl); |
|
| 226 | +} |
|
| 227 | +if ($defaultkey) { |
|
| 228 | + $param .= '&defaultkey=' . urlencode($defaultkey); |
|
| 229 | +} |
|
| 230 | +if ($defaultvalue) { |
|
| 231 | + $param .= '&defaultvalue=' . urlencode($defaultvalue); |
|
| 232 | +} |
|
| 208 | 233 | |
| 209 | 234 | |
| 210 | 235 | print '<form action="' . $_SERVER["PHP_SELF"] . ((empty($user->entity) && $debug) ? '?debug=1' : '') . '" method="POST">'; |
| 211 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 236 | +if ($optioncss != '') { |
|
| 237 | + print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 238 | +} |
|
| 212 | 239 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
| 213 | 240 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
| 214 | 241 | print '<input type="hidden" name="action" value="list">'; |
@@ -269,8 +296,11 @@ discard block |
||
| 269 | 296 | print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder); |
| 270 | 297 | } |
| 271 | 298 | // Entity |
| 272 | -if (!empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,page', '', $param, '', $sortfield, $sortorder); |
|
| 273 | -else print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); |
|
| 299 | +if (!empty($conf->multicompany->enabled) && !$user->entity) { |
|
| 300 | + print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,page', '', $param, '', $sortfield, $sortorder); |
|
| 301 | +} else { |
|
| 302 | + print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); |
|
| 303 | +} |
|
| 274 | 304 | // Actions |
| 275 | 305 | print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); |
| 276 | 306 | print "</tr>\n"; |
@@ -306,7 +336,9 @@ discard block |
||
| 306 | 336 | } |
| 307 | 337 | print '<td align="center">'; |
| 308 | 338 | $disabled = ''; |
| 309 | -if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) $disabled = ' disabled="disabled"'; |
|
| 339 | +if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { |
|
| 340 | + $disabled = ' disabled="disabled"'; |
|
| 341 | +} |
|
| 310 | 342 | print '<input type="submit" class="button"' . $disabled . ' value="' . $langs->trans("Add") . '" name="add">'; |
| 311 | 343 | print "</td>\n"; |
| 312 | 344 | print '</tr>'; |
@@ -335,14 +367,20 @@ discard block |
||
| 335 | 367 | |
| 336 | 368 | // Page |
| 337 | 369 | print '<td>'; |
| 338 | - if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->page; |
|
| 339 | - else print '<input type="text" name="urlpage" value="' . dol_escape_htmltag($obj->page) . '">'; |
|
| 370 | + if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { |
|
| 371 | + print $obj->page; |
|
| 372 | + } else { |
|
| 373 | + print '<input type="text" name="urlpage" value="' . dol_escape_htmltag($obj->page) . '">'; |
|
| 374 | + } |
|
| 340 | 375 | print '</td>' . "\n"; |
| 341 | 376 | |
| 342 | 377 | // Field |
| 343 | 378 | print '<td>'; |
| 344 | - if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->param; |
|
| 345 | - else print '<input type="text" name="key" value="' . dol_escape_htmltag($obj->param) . '">'; |
|
| 379 | + if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { |
|
| 380 | + print $obj->param; |
|
| 381 | + } else { |
|
| 382 | + print '<input type="text" name="key" value="' . dol_escape_htmltag($obj->param) . '">'; |
|
| 383 | + } |
|
| 346 | 384 | print '</td>' . "\n"; |
| 347 | 385 | |
| 348 | 386 | // Value |
@@ -353,8 +391,11 @@ discard block |
||
| 353 | 391 | print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">'; |
| 354 | 392 | print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">'; |
| 355 | 393 | */ |
| 356 | - if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value; |
|
| 357 | - else print '<input type="text" name="value" value="' . dol_escape_htmltag($obj->value) . '">'; |
|
| 394 | + if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { |
|
| 395 | + print $obj->value; |
|
| 396 | + } else { |
|
| 397 | + print '<input type="text" name="value" value="' . dol_escape_htmltag($obj->value) . '">'; |
|
| 398 | + } |
|
| 358 | 399 | print '</td>'; |
| 359 | 400 | } |
| 360 | 401 | |