@@ -26,7 +26,9 @@ |
||
26 | 26 | { |
27 | 27 | foreach ($arrayofvalues as $key => $val) |
28 | 28 | { |
29 | - if (preg_match('/^DOLSESSID_/', $key)) $arrayofvalues[$key] = '*****hidden*****'; |
|
29 | + if (preg_match('/^DOLSESSID_/', $key)) { |
|
30 | + $arrayofvalues[$key] = '*****hidden*****'; |
|
31 | + } |
|
30 | 32 | } |
31 | 33 | //var_dump($arrayofvalues); |
32 | 34 | } |
@@ -20,11 +20,23 @@ discard block |
||
20 | 20 | * \brief File to return Ajax response on payment breakdown process |
21 | 21 | */ |
22 | 22 | |
23 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
24 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
25 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
26 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show |
|
27 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
|
23 | +if (!defined('NOREQUIRESOC')) { |
|
24 | + define('NOREQUIRESOC', '1'); |
|
25 | +} |
|
26 | +if (!defined('NOCSRFCHECK')) { |
|
27 | + define('NOCSRFCHECK', '1'); |
|
28 | +} |
|
29 | +if (!defined('NOTOKENRENEWAL')) { |
|
30 | + define('NOTOKENRENEWAL', '1'); |
|
31 | +} |
|
32 | +if (!defined('NOREQUIREMENU')) { |
|
33 | + define('NOREQUIREMENU', '1'); |
|
34 | +} |
|
35 | +// If there is no menu to show |
|
36 | +if (!defined('NOREQUIREHTML')) { |
|
37 | + define('NOREQUIREHTML', '1'); |
|
38 | +} |
|
39 | +// If we don't need to load the html.form.class.php |
|
28 | 40 | |
29 | 41 | require '../main.inc.php'; |
30 | 42 | |
@@ -50,25 +62,31 @@ discard block |
||
50 | 62 | { |
51 | 63 | $value = price2num($value); |
52 | 64 | $amounts[$key] = $value; |
53 | - if (empty($value)) unset($amounts[$key]); |
|
54 | -} |
|
65 | + if (empty($value)) { |
|
66 | + unset($amounts[$key]); |
|
67 | + } |
|
68 | + } |
|
55 | 69 | // Clean remains |
56 | 70 | foreach ($remains as $key => $value) |
57 | 71 | { |
58 | 72 | $value = price2num($value); |
59 | 73 | $remains[$key] = (($invoice_type) == 2 ?-1 : 1) * $value; |
60 | - if (empty($value)) unset($remains[$key]); |
|
61 | -} |
|
74 | + if (empty($value)) { |
|
75 | + unset($remains[$key]); |
|
76 | + } |
|
77 | + } |
|
62 | 78 | |
63 | 79 | // Treatment |
64 | 80 | $result = ($amountPayment != '') ? ($amountPayment - array_sum($amounts)) : array_sum($amounts); // Remaining amountPayment |
65 | 81 | $toJsonArray = array(); |
66 | 82 | $totalRemaining = price2num(array_sum($remains)); |
67 | 83 | $toJsonArray['label'] = $amountPayment == '' ? '' : $langs->transnoentities('RemainingAmountPayment'); |
68 | -if ($currentInvId) // Here to breakdown |
|
84 | +if ($currentInvId) { |
|
85 | + // Here to breakdown |
|
69 | 86 | { |
70 | 87 | // Get the current amount (from form) and the corresponding remainToPay (from invoice) |
71 | 88 | $currentAmount = $amounts['amount_'.$currentInvId]; |
89 | +} |
|
72 | 90 | $currentRemain = $remains['remain_'.$currentInvId]; |
73 | 91 | |
74 | 92 | // If amountPayment isn't filled, breakdown invoice amount, else breakdown from amountPayment |
@@ -92,11 +110,14 @@ discard block |
||
92 | 110 | $result += price2num($currentAmount); |
93 | 111 | $currentAmount = 0; |
94 | 112 | |
95 | - if ($result >= 0) // then we need to calculate the amount to breakdown |
|
113 | + if ($result >= 0) { |
|
114 | + // then we need to calculate the amount to breakdown |
|
96 | 115 | { |
97 | 116 | $amountToBreakdown = ($result - $currentRemain >= 0 ? |
98 | 117 | $currentRemain : // Remain can be fully paid |
99 | - $currentRemain + ($result - $currentRemain)); // Remain can only partially be paid |
|
118 | + $currentRemain + ($result - $currentRemain)); |
|
119 | + } |
|
120 | + // Remain can only partially be paid |
|
100 | 121 | $currentAmount = $amountToBreakdown; // In both cases, amount will take breakdown value |
101 | 122 | $result -= $amountToBreakdown; // And canceled substraction has been replaced by breakdown |
102 | 123 | } // else there's no need to calc anything, just reset the field (result is still < 0) |
@@ -35,7 +35,9 @@ |
||
35 | 35 | |
36 | 36 | // Security check |
37 | 37 | $socid = GETPOST("socid", "int"); |
38 | -if ($user->socid) $socid = $user->socid; |
|
38 | +if ($user->socid) { |
|
39 | + $socid = $user->socid; |
|
40 | +} |
|
39 | 41 | $result = restrictedArea($user, 'banque', '', '', ''); |
40 | 42 | |
41 | 43 | /* |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | // Security check |
41 | 41 | $socid = GETPOST('socid', 'int'); |
42 | -if ($user->socid) $socid = $user->socid; |
|
42 | +if ($user->socid) { |
|
43 | + $socid = $user->socid; |
|
44 | +} |
|
43 | 45 | $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges'); |
44 | 46 | |
45 | 47 | $object = new ChargeSociales($db); |
@@ -53,9 +55,10 @@ discard block |
||
53 | 55 | { |
54 | 56 | $object->fetch($id); |
55 | 57 | $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); |
56 | - if ($result < 0) |
|
57 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
58 | -} |
|
58 | + if ($result < 0) { |
|
59 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
60 | + } |
|
61 | + } |
|
59 | 62 | |
60 | 63 | |
61 | 64 | /* |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | // Security check |
36 | 36 | $socid = GETPOST('socid', 'int'); |
37 | -if ($user->socid) $socid = $user->socid; |
|
37 | +if ($user->socid) { |
|
38 | + $socid = $user->socid; |
|
39 | +} |
|
38 | 40 | $result = restrictedArea($user, 'tax', '', '', 'charges'); |
39 | 41 | |
40 | 42 | $object = new Tva($db); |
@@ -49,9 +51,10 @@ discard block |
||
49 | 51 | { |
50 | 52 | $object->fetch($id); |
51 | 53 | $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', '', 'text', '', $user, 'TAX_MODIFY'); |
52 | - if ($result < 0) |
|
53 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
54 | -} |
|
54 | + if ($result < 0) { |
|
55 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
56 | + } |
|
57 | + } |
|
55 | 58 | |
56 | 59 | |
57 | 60 | /* |
@@ -32,7 +32,9 @@ |
||
32 | 32 | |
33 | 33 | // Security check |
34 | 34 | $id = GETPOST('id', 'int'); |
35 | -if ($user->socid) $socid = $user->socid; |
|
35 | +if ($user->socid) { |
|
36 | + $socid = $user->socid; |
|
37 | +} |
|
36 | 38 | $result = restrictedArea($user, 'deplacement', $id, ''); |
37 | 39 | |
38 | 40 |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | $object = new Project($db); |
40 | 40 | |
41 | 41 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once |
42 | -if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); |
|
42 | +if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { |
|
43 | + $object->fetchComments(); |
|
44 | +} |
|
43 | 45 | |
44 | 46 | // Security check |
45 | 47 | $socid = 0; |
@@ -61,7 +63,9 @@ discard block |
||
61 | 63 | */ |
62 | 64 | |
63 | 65 | $title = $langs->trans("Project").' - '.$langs->trans("Note").' - '.$object->ref.' '.$object->name; |
64 | -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note"); |
|
66 | +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
67 | + $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note"); |
|
68 | +} |
|
65 | 69 | $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; |
66 | 70 | llxHeader("", $title, $help_url); |
67 | 71 |
@@ -20,13 +20,27 @@ discard block |
||
20 | 20 | * \brief Fichier de javascript de traduction pour JSGantt |
21 | 21 | */ |
22 | 22 | |
23 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
24 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
25 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
26 | -if (!defined('NOLOGIN')) define('NOLOGIN', 1); |
|
27 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
28 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
29 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
23 | +if (!defined('NOREQUIRESOC')) { |
|
24 | + define('NOREQUIRESOC', '1'); |
|
25 | +} |
|
26 | +if (!defined('NOCSRFCHECK')) { |
|
27 | + define('NOCSRFCHECK', 1); |
|
28 | +} |
|
29 | +if (!defined('NOTOKENRENEWAL')) { |
|
30 | + define('NOTOKENRENEWAL', 1); |
|
31 | +} |
|
32 | +if (!defined('NOLOGIN')) { |
|
33 | + define('NOLOGIN', 1); |
|
34 | +} |
|
35 | +if (!defined('NOREQUIREMENU')) { |
|
36 | + define('NOREQUIREMENU', 1); |
|
37 | +} |
|
38 | +if (!defined('NOREQUIREHTML')) { |
|
39 | + define('NOREQUIREHTML', 1); |
|
40 | +} |
|
41 | +if (!defined('NOREQUIREAJAX')) { |
|
42 | + define('NOREQUIREAJAX', '1'); |
|
43 | +} |
|
30 | 44 | |
31 | 45 | require_once __DIR__.'/../main.inc.php'; |
32 | 46 | |
@@ -56,4 +70,6 @@ discard block |
||
56 | 70 | }; |
57 | 71 | var vLang='<?php print $langs->getDefaultLang(1); ?>'; |
58 | 72 | <?php |
59 | -if (is_object($db)) $db->close(); |
|
73 | +if (is_object($db)) { |
|
74 | + $db->close(); |
|
75 | +} |
@@ -16,11 +16,21 @@ |
||
16 | 16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
17 | 17 | */ |
18 | 18 | |
19 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
20 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
21 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
22 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
23 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
19 | +if (!defined('NOTOKENRENEWAL')) { |
|
20 | + define('NOTOKENRENEWAL', '1'); |
|
21 | +} |
|
22 | +if (!defined('NOREQUIREMENU')) { |
|
23 | + define('NOREQUIREMENU', '1'); |
|
24 | +} |
|
25 | +if (!defined('NOREQUIREHTML')) { |
|
26 | + define('NOREQUIREHTML', '1'); |
|
27 | +} |
|
28 | +if (!defined('NOREQUIREAJAX')) { |
|
29 | + define('NOREQUIREAJAX', '1'); |
|
30 | +} |
|
31 | +if (!defined('NOREQUIRESOC')) { |
|
32 | + define('NOREQUIRESOC', '1'); |
|
33 | +} |
|
24 | 34 | |
25 | 35 | require '../../main.inc.php'; |
26 | 36 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |