Passed
Branch develop (44ed59)
by
unknown
28:39
created
htdocs/public/members/public_card.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
 */
153 153
 function llxFooterVierge()
154 154
 {
155
-    printCommonFooter('public');
155
+	printCommonFooter('public');
156 156
 
157 157
 	print "</body>\n";
158 158
 	print "</html>\n";
Please login to merge, or discard this patch.
Braces   +27 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,15 +25,26 @@  discard block
 block discarded – undo
25 25
  * 	\brief      File to show a public card of a member
26 26
  */
27 27
 
28
-if (!defined('NOLOGIN'))		define("NOLOGIN", 1); // This means this output page does not require to be logged.
29
-if (!defined('NOCSRFCHECK'))	define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
30
-if (!defined('NOIPCHECK'))		define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
28
+if (!defined('NOLOGIN')) {
29
+	define("NOLOGIN", 1);
30
+}
31
+// This means this output page does not require to be logged.
32
+if (!defined('NOCSRFCHECK')) {
33
+	define("NOCSRFCHECK", 1);
34
+}
35
+// We accept to go on this page from external web site.
36
+if (!defined('NOIPCHECK')) {
37
+	define('NOIPCHECK', '1');
38
+}
39
+// Do not check IP defined into conf $dolibarr_main_restrict_ip
31 40
 
32 41
 // For MultiCompany module.
33 42
 // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
34 43
 // TODO This should be useless. Because entity must be retreive from object ref and not from url.
35 44
 $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
36
-if (is_numeric($entity)) define("DOLENTITY", $entity);
45
+if (is_numeric($entity)) {
46
+	define("DOLENTITY", $entity);
47
+}
37 48
 
38 49
 require '../../main.inc.php';
39 50
 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -41,7 +52,9 @@  discard block
 block discarded – undo
41 52
 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
42 53
 
43 54
 // Security check
44
-if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
55
+if (empty($conf->adherent->enabled)) {
56
+	accessforbidden('', 0, 0, 1);
57
+}
45 58
 
46 59
 
47 60
 $langs->loadLangs(array("main", "members", "companies", "other"));
@@ -65,8 +78,11 @@  discard block
 block discarded – undo
65 78
  */
66 79
 
67 80
 $morehead = '';
68
-if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
69
-else $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">';
81
+if (!empty($conf->global->MEMBER_PUBLIC_CSS)) {
82
+	$morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
83
+} else {
84
+	$morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">';
85
+}
70 86
 
71 87
 llxHeaderVierge($langs->trans("MemberCard"), $morehead);
72 88
 
@@ -84,8 +100,7 @@  discard block
 block discarded – undo
84 100
 	if (empty($object->public))
85 101
 	{
86 102
 		 print $langs->trans("ErrorThisMemberIsNotPublic");
87
-	}
88
-	else
103
+	} else
89 104
 	{
90 105
 		print '<table class="public_border" cellspacing="0" width="100%" cellpadding="3">';
91 106
 
@@ -140,7 +155,9 @@  discard block
 block discarded – undo
140 155
 	print "<html>\n";
141 156
 	print "<head>\n";
142 157
 	print "<title>".$title."</title>\n";
143
-	if ($head) print $head."\n";
158
+	if ($head) {
159
+		print $head."\n";
160
+	}
144 161
 	print "</head>\n";
145 162
 	print '<body class="public_body">'."\n";
146 163
 }
Please login to merge, or discard this patch.
htdocs/public/members/public_list.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 
59 59
 	header("Content-type: text/html; charset=".$conf->file->character_set_client);
60 60
 	print "<html>\n";
61
-    print "<head>\n";
62
-    print "<title>".$title."</title>\n";
63
-    if ($head) print $head."\n";
64
-    print "</head>\n";
61
+	print "<head>\n";
62
+	print "<title>".$title."</title>\n";
63
+	if ($head) print $head."\n";
64
+	print "</head>\n";
65 65
 	print '<body class="public_body">'."\n";
66 66
 }
67 67
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function llxFooterVierge()
74 74
 {
75
-    printCommonFooter('public');
75
+	printCommonFooter('public');
76 76
 
77
-    print "</body>\n";
77
+	print "</body>\n";
78 78
 	print "</html>\n";
79 79
 }
80 80
 
Please login to merge, or discard this patch.
Braces   +28 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,20 +24,33 @@  discard block
 block discarded – undo
24 24
  *  \brief      File sample to list members
25 25
  */
26 26
 
27
-if (!defined('NOLOGIN'))		define("NOLOGIN", 1); // This means this output page does not require to be logged.
28
-if (!defined('NOCSRFCHECK'))	define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
29
-if (!defined('NOIPCHECK'))		define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
27
+if (!defined('NOLOGIN')) {
28
+	define("NOLOGIN", 1);
29
+}
30
+// This means this output page does not require to be logged.
31
+if (!defined('NOCSRFCHECK')) {
32
+	define("NOCSRFCHECK", 1);
33
+}
34
+// We accept to go on this page from external web site.
35
+if (!defined('NOIPCHECK')) {
36
+	define('NOIPCHECK', '1');
37
+}
38
+// Do not check IP defined into conf $dolibarr_main_restrict_ip
30 39
 
31 40
 // For MultiCompany module.
32 41
 // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
33 42
 // TODO This should be useless. Because entity must be retreive from object ref and not from url.
34 43
 $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
35
-if (is_numeric($entity)) define("DOLENTITY", $entity);
44
+if (is_numeric($entity)) {
45
+	define("DOLENTITY", $entity);
46
+}
36 47
 
37 48
 require '../../main.inc.php';
38 49
 
39 50
 // Security check
40
-if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
51
+if (empty($conf->adherent->enabled)) {
52
+	accessforbidden('', 0, 0, 1);
53
+}
41 54
 
42 55
 
43 56
 $langs->loadLangs(array("main", "members", "companies", "other"));
@@ -58,7 +71,9 @@  discard block
 block discarded – undo
58 71
 	print "<html>\n";
59 72
     print "<head>\n";
60 73
     print "<title>".$title."</title>\n";
61
-    if ($head) print $head."\n";
74
+    if ($head) {
75
+    	print $head."\n";
76
+    }
62 77
     print "</head>\n";
63 78
 	print '<body class="public_body">'."\n";
64 79
 }
@@ -100,8 +115,11 @@  discard block
 block discarded – undo
100 115
 $form = new Form($db);
101 116
 
102 117
 $morehead = '';
103
-if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
104
-else $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">';
118
+if (!empty($conf->global->MEMBER_PUBLIC_CSS)) {
119
+	$morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
120
+} else {
121
+	$morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">';
122
+}
105 123
 
106 124
 llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead);
107 125
 
@@ -152,8 +170,7 @@  discard block
 block discarded – undo
152 170
 			print '<td>';
153 171
 			print $form->showphoto('memberphoto', $objp, 64);
154 172
 			print '</td>'."\n";
155
-		}
156
-		else
173
+		} else
157 174
 		{
158 175
 			print "<td>&nbsp;</td>\n";
159 176
 		}
@@ -161,8 +178,7 @@  discard block
 block discarded – undo
161 178
 		$i++;
162 179
 	}
163 180
 	print "</table>";
164
-}
165
-else
181
+} else
166 182
 {
167 183
 	dol_print_error($db);
168 184
 }
Please login to merge, or discard this patch.
htdocs/public/emailing/mailing-read.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 
78 78
 	$resql=$db->query($sql);
79 79
 
80
-    //Update status communication of contact prospect
80
+	//Update status communication of contact prospect
81 81
 	$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
82 82
 	dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG);
83 83
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
  *      \brief      Script use to update mail status if destinaries read it (if images during mail read are display)
26 26
  */
27 27
 
28
-if (! defined('NOLOGIN'))        define("NOLOGIN", 1);			// This means this output page does not require to be logged.
29
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
30
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');		// Do not check anti CSRF attack test
31
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');	// Do not check anti POST attack test
32
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');	// If there is no need to load and show top and left menu
28
+if (!defined('NOLOGIN'))        define("NOLOGIN", 1); // This means this output page does not require to be logged.
29
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
30
+if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
31
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
32
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
33 33
 
34 34
 /**
35 35
  * Header empty
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 
52 52
 require '../../main.inc.php';
53 53
 
54
-$tag=GETPOST('tag');
55
-$securitykey=GETPOST('securitykey');
54
+$tag = GETPOST('tag');
55
+$securitykey = GETPOST('securitykey');
56 56
 
57 57
 
58 58
 /*
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
 	exit;
68 68
 }
69 69
 
70
-if (! empty($tag))
70
+if (!empty($tag))
71 71
 {
72
-	$statut='2';
72
+	$statut = '2';
73 73
 	$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'";
74 74
 	dol_syslog("public/emailing/mailing-read.php : Mail read : ".$sql, LOG_DEBUG);
75 75
 
76
-	$resql=$db->query($sql);
76
+	$resql = $db->query($sql);
77 77
 
78 78
 	//Update status communication of thirdparty prospect
79 79
 	$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)";
80 80
 	dol_syslog("public/emailing/mailing-read.php : Mail read thirdparty : ".$sql, LOG_DEBUG);
81 81
 
82
-	$resql=$db->query($sql);
82
+	$resql = $db->query($sql);
83 83
 
84 84
     //Update status communication of contact prospect
85 85
 	$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
86 86
 	dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG);
87 87
 
88
-	$resql=$db->query($sql);
88
+	$resql = $db->query($sql);
89 89
 }
90 90
 
91 91
 $db->close();
Please login to merge, or discard this patch.
Braces   +19 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,11 +25,25 @@
 block discarded – undo
25 25
  *      \brief      Script use to update mail status if destinaries read it (if images during mail read are display)
26 26
  */
27 27
 
28
-if (! defined('NOLOGIN'))        define("NOLOGIN", 1);			// This means this output page does not require to be logged.
29
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
30
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');		// Do not check anti CSRF attack test
31
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');	// Do not check anti POST attack test
32
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');	// If there is no need to load and show top and left menu
28
+if (! defined('NOLOGIN')) {
29
+	define("NOLOGIN", 1);
30
+}
31
+// This means this output page does not require to be logged.
32
+if (! defined('NOREQUIRETRAN')) {
33
+	define('NOREQUIRETRAN', '1');
34
+}
35
+if (! defined('NOCSRFCHECK')) {
36
+	define('NOCSRFCHECK', '1');
37
+}
38
+// Do not check anti CSRF attack test
39
+if (! defined('NOTOKENRENEWAL')) {
40
+	define('NOTOKENRENEWAL', '1');
41
+}
42
+// Do not check anti POST attack test
43
+if (! defined('NOREQUIREMENU')) {
44
+	define('NOREQUIREMENU', '1');
45
+}
46
+// If there is no need to load and show top and left menu
33 47
 
34 48
 /**
35 49
  * Header empty
Please login to merge, or discard this patch.
htdocs/public/error-401.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     Sorry. You are not allowed to access this resource.
22 22
 
23 23
     <br>
24
-    <?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?>
24
+    <?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.$_SERVER["HTTP_REFERER"].'.' : ''; ?>
25 25
 
26 26
     <hr>
27 27
 
Please login to merge, or discard this patch.
htdocs/public/opensurvey/studs.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -245,13 +245,13 @@
 block discarded – undo
245 245
 
246 246
 if (empty($object->ref))     // For survey, id is a hex string
247 247
 {
248
-    $langs->load("errors");
249
-    print $langs->trans("ErrorRecordNotFound");
248
+	$langs->load("errors");
249
+	print $langs->trans("ErrorRecordNotFound");
250 250
 
251
-    llxFooterSurvey();
251
+	llxFooterSurvey();
252 252
 
253
-    $db->close();
254
-    exit();
253
+	$db->close();
254
+	exit();
255 255
 }
256 256
 
257 257
 // Define format of choices
Please login to merge, or discard this patch.
Braces   +162 added lines, -76 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
 $canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED);
49 49
 
50 50
 // Security check
51
-if (empty($conf->opensurvey->enabled)) accessforbidden('', 0, 0, 1);
51
+if (empty($conf->opensurvey->enabled)) {
52
+	accessforbidden('', 0, 0, 1);
53
+}
52 54
 
53 55
 
54 56
 /*
@@ -62,7 +64,9 @@  discard block
 block discarded – undo
62 64
 // Add comment
63 65
 if (GETPOST('ajoutcomment', 'alpha'))
64 66
 {
65
-	if (!$canbemodified) accessforbidden('', 0, 0, 1);
67
+	if (!$canbemodified) {
68
+		accessforbidden('', 0, 0, 1);
69
+	}
66 70
 
67 71
 	$error = 0;
68 72
 
@@ -90,14 +94,18 @@  discard block
 block discarded – undo
90 94
 	{
91 95
 		$resql = $object->addComment($comment, $comment_user);
92 96
 
93
-		if (!$resql) dol_print_error($db);
97
+		if (!$resql) {
98
+			dol_print_error($db);
99
+		}
94 100
 	}
95 101
 }
96 102
 
97 103
 // Add vote
98
-if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x"))		// boutonp for chrome, boutonp_x for firefox
104
+if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) {
105
+	// boutonp for chrome, boutonp_x for firefox
99 106
 {
100 107
 	if (!$canbemodified) accessforbidden('', 0, 0, 1);
108
+}
101 109
 
102 110
 	//Si le nom est bien entré
103 111
 	if (GETPOST('nom', 'nohtml'))
@@ -108,12 +116,10 @@  discard block
 block discarded – undo
108 116
 			if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1')
109 117
 			{
110 118
 				$nouveauchoix .= "1";
111
-			}
112
-			elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
119
+			} elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
113 120
 			{
114 121
 				$nouveauchoix .= "2";
115
-			}
116
-			else { // sinon c'est 0
122
+			} else { // sinon c'est 0
117 123
 				$nouveauchoix .= "0";
118 124
 			}
119 125
 		}
@@ -125,15 +131,16 @@  discard block
 block discarded – undo
125 131
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
126 132
 		$sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users";
127 133
 		$resql = $db->query($sql);
128
-		if (!$resql) dol_print_error($db);
134
+		if (!$resql) {
135
+			dol_print_error($db);
136
+		}
129 137
 
130 138
 		$num_rows = $db->num_rows($resql);
131 139
 		if ($num_rows > 0)
132 140
 		{
133 141
 			setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors');
134 142
 			$error++;
135
-		}
136
-		else
143
+		} else
137 144
 		{
138 145
 			$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)';
139 146
 			$sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')";
@@ -169,11 +176,11 @@  discard block
 block discarded – undo
169 176
 						$result = $cmailfile->sendfile();
170 177
 					}
171 178
 				}
179
+			} else {
180
+				dol_print_error($db);
172 181
 			}
173
-			else dol_print_error($db);
174 182
 		}
175
-	}
176
-	else
183
+	} else
177 184
 	{
178 185
 		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors');
179 186
 	}
@@ -210,17 +217,17 @@  discard block
 block discarded – undo
210 217
 		if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1')
211 218
 		{
212 219
 			$nouveauchoix .= "1";
213
-		}
214
-		elseif (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2')
220
+		} elseif (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2')
215 221
 		{
216 222
 			$nouveauchoix .= "2";
217
-		}
218
-		else { // sinon c'est 0
223
+		} else { // sinon c'est 0
219 224
 			$nouveauchoix .= "0";
220 225
 		}
221 226
 	}
222 227
 
223
-	if (!$canbemodified) accessforbidden('', 0, 0, 1);
228
+	if (!$canbemodified) {
229
+		accessforbidden('', 0, 0, 1);
230
+	}
224 231
 
225 232
 	$idtomodify = $_POST["idtomodify".$modifier];
226 233
 	$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs";
@@ -228,14 +235,18 @@  discard block
 block discarded – undo
228 235
 	$sql .= " WHERE id_users = '".$db->escape($idtomodify)."'";
229 236
 
230 237
 	$resql = $db->query($sql);
231
-	if (!$resql) dol_print_error($db);
232
-}
238
+	if (!$resql) {
239
+		dol_print_error($db);
240
+	}
241
+	}
233 242
 
234 243
 // Delete comment
235 244
 $idcomment = GETPOST('deletecomment', 'int');
236 245
 if ($idcomment)
237 246
 {
238
-	if (!$canbemodified) accessforbidden('', 0, 0, 1);
247
+	if (!$canbemodified) {
248
+		accessforbidden('', 0, 0, 1);
249
+	}
239 250
 
240 251
 	$resql = $object->deleteComment($idcomment);
241 252
 }
@@ -252,9 +263,11 @@  discard block
 block discarded – undo
252 263
 $arrayofcss = array('/opensurvey/css/style.css');
253 264
 llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss);
254 265
 
255
-if (empty($object->ref))     // For survey, id is a hex string
266
+if (empty($object->ref)) {
267
+	// For survey, id is a hex string
256 268
 {
257 269
     $langs->load("errors");
270
+}
258 271
     print $langs->trans("ErrorRecordNotFound");
259 272
 
260 273
     llxFooterSurvey();
@@ -392,8 +405,7 @@  discard block
 block discarded – undo
392 405
 
393 406
 		print '</tr>'."\n";
394 407
 	}
395
-}
396
-else
408
+} else
397 409
 {
398 410
 	//display of survey topics
399 411
 	print '<tr>'."\n";
@@ -452,37 +464,67 @@  discard block
 block discarded – undo
452 464
 
453 465
 			if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
454 466
 			{
455
-				if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n";
456
-				else print '<td class="non">KO</td>'."\n";
467
+				if (((string) $car) == "1") {
468
+					print '<td class="ok">OK</td>'."\n";
469
+				} else {
470
+					print '<td class="non">KO</td>'."\n";
471
+				}
457 472
 				// Total
458
-				if (!isset($sumfor[$i])) $sumfor[$i] = 0;
459
-				if (((string) $car) == "1") $sumfor[$i]++;
473
+				if (!isset($sumfor[$i])) {
474
+					$sumfor[$i] = 0;
475
+				}
476
+				if (((string) $car) == "1") {
477
+					$sumfor[$i]++;
478
+				}
460 479
 			}
461 480
 			if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
462 481
 			{
463
-				if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n";
464
-				elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n";
465
-				else print '<td class="vide">&nbsp;</td>'."\n";
482
+				if (((string) $car) == "1") {
483
+					print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n";
484
+				} elseif (((string) $car) == "0") {
485
+					print '<td class="non">'.$langs->trans("No").'</td>'."\n";
486
+				} else {
487
+					print '<td class="vide">&nbsp;</td>'."\n";
488
+				}
466 489
 				// Total
467
-				if (!isset($sumfor[$i])) $sumfor[$i] = 0;
468
-				if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
469
-				if (((string) $car) == "1") $sumfor[$i]++;
470
-				if (((string) $car) == "0") $sumagainst[$i]++;
490
+				if (!isset($sumfor[$i])) {
491
+					$sumfor[$i] = 0;
492
+				}
493
+				if (!isset($sumagainst[$i])) {
494
+					$sumagainst[$i] = 0;
495
+				}
496
+				if (((string) $car) == "1") {
497
+					$sumfor[$i]++;
498
+				}
499
+				if (((string) $car) == "0") {
500
+					$sumagainst[$i]++;
501
+				}
471 502
 			}
472 503
 			if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
473 504
 			{
474
-				if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
475
-				elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
476
-				else print '<td class="vide">&nbsp;</td>'."\n";
505
+				if (((string) $car) == "1") {
506
+					print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
507
+				} elseif (((string) $car) == "0") {
508
+					print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
509
+				} else {
510
+					print '<td class="vide">&nbsp;</td>'."\n";
511
+				}
477 512
 				// Total
478
-				if (!isset($sumfor[$i])) $sumfor[$i] = 0;
479
-				if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
480
-				if (((string) $car) == "1") $sumfor[$i]++;
481
-				if (((string) $car) == "0") $sumagainst[$i]++;
513
+				if (!isset($sumfor[$i])) {
514
+					$sumfor[$i] = 0;
515
+				}
516
+				if (!isset($sumagainst[$i])) {
517
+					$sumagainst[$i] = 0;
518
+				}
519
+				if (((string) $car) == "1") {
520
+					$sumfor[$i]++;
521
+				}
522
+				if (((string) $car) == "0") {
523
+					$sumagainst[$i]++;
524
+				}
482 525
 			}
483 526
 		}
484
-	}
485
-	else
527
+	} else
486 528
 	{
487 529
 		//sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs
488 530
 		if ($compteur == $ligneamodifier)
@@ -494,7 +536,9 @@  discard block
 block discarded – undo
494 536
 				if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
495 537
 				{
496 538
 					print '<input type="checkbox" name="choix'.$i.'" value="1" ';
497
-					if ($car == '1') print 'checked';
539
+					if ($car == '1') {
540
+						print 'checked';
541
+					}
498 542
 					print '>';
499 543
 				}
500 544
 				if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
@@ -509,41 +553,71 @@  discard block
 block discarded – undo
509 553
 				}
510 554
 				print '</td>'."\n";
511 555
 			}
512
-		}
513
-		else
556
+		} else
514 557
 		{
515 558
 			for ($i = 0; $i < $nbcolonnes; $i++)
516 559
 			{
517 560
 				$car = substr($ensemblereponses, $i, 1);
518 561
 				if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
519 562
 				{
520
-					if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n";
521
-					else print '<td class="non">KO</td>'."\n";
563
+					if (((string) $car) == "1") {
564
+						print '<td class="ok">OK</td>'."\n";
565
+					} else {
566
+						print '<td class="non">KO</td>'."\n";
567
+					}
522 568
 					// Total
523
-					if (!isset($sumfor[$i])) $sumfor[$i] = 0;
524
-					if (((string) $car) == "1") $sumfor[$i]++;
569
+					if (!isset($sumfor[$i])) {
570
+						$sumfor[$i] = 0;
571
+					}
572
+					if (((string) $car) == "1") {
573
+						$sumfor[$i]++;
574
+					}
525 575
 				}
526 576
 				if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
527 577
 				{
528
-					if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
529
-					elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
530
-					else print '<td class="vide">&nbsp;</td>'."\n";
578
+					if (((string) $car) == "1") {
579
+						print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
580
+					} elseif (((string) $car) == "0") {
581
+						print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
582
+					} else {
583
+						print '<td class="vide">&nbsp;</td>'."\n";
584
+					}
531 585
 					// Total
532
-					if (!isset($sumfor[$i])) $sumfor[$i] = 0;
533
-					if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
534
-					if (((string) $car) == "1") $sumfor[$i]++;
535
-					if (((string) $car) == "0") $sumagainst[$i]++;
586
+					if (!isset($sumfor[$i])) {
587
+						$sumfor[$i] = 0;
588
+					}
589
+					if (!isset($sumagainst[$i])) {
590
+						$sumagainst[$i] = 0;
591
+					}
592
+					if (((string) $car) == "1") {
593
+						$sumfor[$i]++;
594
+					}
595
+					if (((string) $car) == "0") {
596
+						$sumagainst[$i]++;
597
+					}
536 598
 				}
537 599
 				if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
538 600
 				{
539
-					if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
540
-					elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
541
-					else print '<td class="vide">&nbsp;</td>'."\n";
601
+					if (((string) $car) == "1") {
602
+						print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
603
+					} elseif (((string) $car) == "0") {
604
+						print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
605
+					} else {
606
+						print '<td class="vide">&nbsp;</td>'."\n";
607
+					}
542 608
 					// Total
543
-					if (!isset($sumfor[$i])) $sumfor[$i] = 0;
544
-					if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
545
-					if (((string) $car) == "1") $sumfor[$i]++;
546
-					if (((string) $car) == "0") $sumagainst[$i]++;
609
+					if (!isset($sumfor[$i])) {
610
+						$sumfor[$i] = 0;
611
+					}
612
+					if (!isset($sumagainst[$i])) {
613
+						$sumagainst[$i] = 0;
614
+					}
615
+					if (((string) $car) == "1") {
616
+						$sumfor[$i]++;
617
+					}
618
+					if (((string) $car) == "0") {
619
+						$sumagainst[$i]++;
620
+					}
547 621
 				}
548 622
 			}
549 623
 		}
@@ -622,8 +696,9 @@  discard block
 block discarded – undo
622 696
 $nbofcheckbox = 0;
623 697
 for ($i = 0; $i < $nbcolonnes; $i++)
624 698
 {
625
-	if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
626
-	$nbofcheckbox++;
699
+	if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
700
+		$nbofcheckbox++;
701
+	}
627 702
 	if (isset($sumfor[$i]))
628 703
 	{
629 704
 		if ($i == 0)
@@ -645,13 +720,23 @@  discard block
 block discarded – undo
645 720
 	{
646 721
 		$showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : '';
647 722
 		$showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : '';
648
-		if (empty($showsumfor)) $showsumfor = 0;
649
-		if (empty($showsumagainst)) $showsumagainst = 0;
723
+		if (empty($showsumfor)) {
724
+			$showsumfor = 0;
725
+		}
726
+		if (empty($showsumagainst)) {
727
+			$showsumagainst = 0;
728
+		}
650 729
 
651 730
 		print '<td>';
652
-		if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor;
653
-		if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst;
654
-		if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst;
731
+		if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
732
+			print $showsumfor;
733
+		}
734
+		if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
735
+			print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst;
736
+		}
737
+		if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
738
+			print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst;
739
+		}
655 740
 		print '</td>'."\n";
656 741
 	}
657 742
 	print '</tr>';
@@ -695,8 +780,7 @@  discard block
 block discarded – undo
695 780
 				} else {
696 781
 					$meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').' ('.dol_print_date($toutsujet[$i], '%A').')';
697 782
 				}
698
-			}
699
-			else
783
+			} else
700 784
 			{
701 785
 				$tmps = explode('@', $toutsujet[$i]);
702 786
 				$meilleursujet .= dol_htmlentities($tmps[0]);
@@ -741,7 +825,9 @@  discard block
 block discarded – undo
741 825
 		//$mod_ok = (in_array($obj->name, $listofvoters));
742 826
 
743 827
 		print '<div class="comment"><span class="usercomment">';
744
-		if (in_array($obj->usercomment, $listofvoters)) print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png', '', false, 0, 0, '', 'nomarginleft').'</a> ';
828
+		if (in_array($obj->usercomment, $listofvoters)) {
829
+			print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png', '', false, 0, 0, '', 'nomarginleft').'</a> ';
830
+		}
745 831
 		//else print img_picto('', 'ellipsis-h', '', false, 0, 0, '', 'nomarginleft').' ';
746 832
 		print dol_htmlentities($obj->usercomment).':</span> <span class="comment">'.dol_nl2br(dol_htmlentities($obj->comment))."</span></div>";
747 833
 	}
Please login to merge, or discard this patch.
htdocs/public/error-404.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     You requested a website or a page that does not exists.
22 22
 
23 23
     <br>
24
-    <?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?>
24
+    <?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.$_SERVER["HTTP_REFERER"].'.' : ''; ?>
25 25
 
26 26
     <hr>
27 27
 
Please login to merge, or discard this patch.
htdocs/webservices/server_payment.php 3 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -146,7 +146,9 @@  discard block
 block discarded – undo
146 146
     dol_syslog("Function: createPayment login=".$authentication['login']." id=".$payment->id.
147 147
                ", ref=".$payment->ref.", ref_ext=".$payment->ref_ext);
148 148
 
149
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
149
+    if ($authentication['entity']) {
150
+    	$conf->entity=$authentication['entity'];
151
+    }
150 152
 
151 153
     // Init and check authentication
152 154
     $objectresp = array();
@@ -196,8 +198,7 @@  discard block
 block discarded – undo
196 198
         {
197 199
             $db->commit();
198 200
             $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$new_payment->id);
199
-        }
200
-        else
201
+        } else
201 202
         {
202 203
             $db->rollback();
203 204
             $error++;
Please login to merge, or discard this patch.
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 // Enable and test if module web services is enabled
45 45
 if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
46 46
 {
47
-       $langs->load("admin");
48
-       dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled");
49
-       print $langs->trans("WarningModuleNotActive", 'WebServices').'.<br><br>';
50
-       print $langs->trans("ToActivateModule");
51
-       exit;
47
+	   $langs->load("admin");
48
+	   dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled");
49
+	   print $langs->trans("WarningModuleNotActive", 'WebServices').'.<br><br>';
50
+	   print $langs->trans("ToActivateModule");
51
+	   exit;
52 52
 }
53 53
 
54 54
 // Create the soap Object
@@ -62,50 +62,50 @@  discard block
 block discarded – undo
62 62
 
63 63
 // Define WSDL Authentication object
64 64
 $server->wsdl->addComplexType(
65
-    'authentication',
66
-    'complexType',
67
-    'struct',
68
-    'all',
69
-    '',
70
-    array(
71
-        'dolibarrkey'       => array('name'=>'dolibarrkey','type'=>'xsd:string'),
72
-       'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'),
73
-       'login'             => array('name'=>'login','type'=>'xsd:string'),
74
-        'password'          => array('name'=>'password','type'=>'xsd:string'),
75
-        'entity'            => array('name'=>'entity','type'=>'xsd:string')
76
-    )
65
+	'authentication',
66
+	'complexType',
67
+	'struct',
68
+	'all',
69
+	'',
70
+	array(
71
+		'dolibarrkey'       => array('name'=>'dolibarrkey','type'=>'xsd:string'),
72
+	   'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'),
73
+	   'login'             => array('name'=>'login','type'=>'xsd:string'),
74
+		'password'          => array('name'=>'password','type'=>'xsd:string'),
75
+		'entity'            => array('name'=>'entity','type'=>'xsd:string')
76
+	)
77 77
 );
78 78
 // Define WSDL Return object
79 79
 $server->wsdl->addComplexType(
80
-    'result',
81
-    'complexType',
82
-    'struct',
83
-    'all',
84
-    '',
85
-    array(
86
-        'result_code'  => array('name'=>'result_code','type'=>'xsd:string'),
87
-        'result_label' => array('name'=>'result_label','type'=>'xsd:string'),
88
-    )
80
+	'result',
81
+	'complexType',
82
+	'struct',
83
+	'all',
84
+	'',
85
+	array(
86
+		'result_code'  => array('name'=>'result_code','type'=>'xsd:string'),
87
+		'result_label' => array('name'=>'result_label','type'=>'xsd:string'),
88
+	)
89 89
 );
90 90
 
91 91
 // Define WSDL for Payment object
92 92
 $server->wsdl->addComplexType(
93
-    'payment',
94
-    'complexType',
95
-    'struct',
96
-    'all',
97
-    '',
98
-    array(
99
-        'amount'          => array('name'=>'amount','type'=>'xsd:double'),
100
-        'num_paiement'    => array('name'=>'num_paiement','type'=>'xsd:string'),
101
-        'thirdparty_id'   => array('name'=>'thirdparty_id','type'=>'xsd:int'),
102
-               'bank_account'    => array('name'=>'bank_account','type'=>'xsd:int'),
103
-               'payment_mode_id' => array('name'=>'payment_mode_id','type'=>'xsd:int'),
104
-               'invoice_id'      => array('name'=>'invoice_id','type'=>'xsd:int'),
105
-               'int_label'       => array('name'=>'int_label','type'=>'xsd:string'),
106
-               'emitter'         => array('name'=>'emitter','type'=>'xsd:string'),
107
-               'bank_source'     => array('name'=>'bank_source','type'=>'xsd:string'),
108
-    )
93
+	'payment',
94
+	'complexType',
95
+	'struct',
96
+	'all',
97
+	'',
98
+	array(
99
+		'amount'          => array('name'=>'amount','type'=>'xsd:double'),
100
+		'num_paiement'    => array('name'=>'num_paiement','type'=>'xsd:string'),
101
+		'thirdparty_id'   => array('name'=>'thirdparty_id','type'=>'xsd:int'),
102
+			   'bank_account'    => array('name'=>'bank_account','type'=>'xsd:int'),
103
+			   'payment_mode_id' => array('name'=>'payment_mode_id','type'=>'xsd:int'),
104
+			   'invoice_id'      => array('name'=>'invoice_id','type'=>'xsd:int'),
105
+			   'int_label'       => array('name'=>'int_label','type'=>'xsd:string'),
106
+			   'emitter'         => array('name'=>'emitter','type'=>'xsd:string'),
107
+			   'bank_source'     => array('name'=>'bank_source','type'=>'xsd:string'),
108
+	)
109 109
 );
110 110
 
111 111
 // 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 
118 118
 // Register WSDL
119 119
 $server->register(
120
-    'createPayment',
121
-    // Entry values
122
-    array('authentication'=>'tns:authentication','payment'=>'tns:payment'),
123
-    // Exit values
124
-    array('result'=>'tns:result','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'),
125
-    $ns,
126
-    $ns.'#createPayment',
127
-    $styledoc,
128
-    $styleuse,
129
-    'WS to create a new payment'
120
+	'createPayment',
121
+	// Entry values
122
+	array('authentication'=>'tns:authentication','payment'=>'tns:payment'),
123
+	// Exit values
124
+	array('result'=>'tns:result','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'),
125
+	$ns,
126
+	$ns.'#createPayment',
127
+	$styledoc,
128
+	$styleuse,
129
+	'WS to create a new payment'
130 130
 );
131 131
 
132 132
 
@@ -139,80 +139,80 @@  discard block
 block discarded – undo
139 139
  */
140 140
 function createPayment($authentication, $payment)
141 141
 {
142
-    global $db,$conf,$langs;
143
-
144
-    $now = dol_now();
145
-
146
-    dol_syslog("Function: createPayment login=".$authentication['login']." id=".$payment->id.
147
-               ", ref=".$payment->ref.", ref_ext=".$payment->ref_ext);
148
-
149
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
150
-
151
-    // Init and check authentication
152
-    $objectresp = array();
153
-    $errorcode  = '';
154
-    $errorlabel = '';
155
-    $error      = 0;
156
-    $fuser      = check_authentication($authentication, $error, $errorcode, $errorlabel);
157
-
158
-    // Check parameters
159
-    if (empty($payment['amount']) && empty($payment['thirdparty_id'])) {
160
-        $error++;
161
-        $errorcode  ='KO';
162
-        $errorlabel ="You must specify the amount and the third party's ID.";
163
-    }
164
-
165
-    if (! $error)
166
-    {
167
-        $soc = new Societe($db);
168
-        $res = $soc->fetch($payment['thirdparty_id']);
169
-
170
-        $new_payment               = new Paiement($db);
171
-        $new_payment->amount       = doubleval($payment['amount']);
172
-        $new_payment->num_paiement = $payment['num_paiement'];
173
-        $new_payment->bank_account = intval($payment['bank_account']);
174
-        $new_payment->paiementid   = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id;
175
-        $new_payment->datepaye     = $now;
176
-        $new_payment->author       = $payment['thirdparty_id'];
177
-        $new_payment->amounts      = array();
178
-
179
-        if (intval($payment['invoice_id']) > 0) {
180
-            $new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount;
181
-        }
182
-
183
-        $db->begin();
184
-        $result = $new_payment->create($fuser, true);
185
-
186
-        if ($payment['bank_account']) {
187
-            $new_payment->addPaymentToBank($fuser, 'payment', $payment['int_label'], $payment['bank_account'], $payment['emitter'], $payment['bank_source']);
188
-        }
189
-
190
-        if ($result < 0)
191
-        {
192
-            $error++;
193
-        }
194
-
195
-        if (! $error)
196
-        {
197
-            $db->commit();
198
-            $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$new_payment->id);
199
-        }
200
-        else
201
-        {
202
-            $db->rollback();
203
-            $error++;
204
-            $errorcode='KO';
205
-            $errorlabel=$new_payment->error;
206
-            dol_syslog("Function: createInvoice error while creating".$errorlabel);
207
-        }
208
-    }
209
-
210
-    if ($error)
211
-    {
212
-        $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
213
-    }
214
-
215
-    return $objectresp;
142
+	global $db,$conf,$langs;
143
+
144
+	$now = dol_now();
145
+
146
+	dol_syslog("Function: createPayment login=".$authentication['login']." id=".$payment->id.
147
+			   ", ref=".$payment->ref.", ref_ext=".$payment->ref_ext);
148
+
149
+	if ($authentication['entity']) $conf->entity=$authentication['entity'];
150
+
151
+	// Init and check authentication
152
+	$objectresp = array();
153
+	$errorcode  = '';
154
+	$errorlabel = '';
155
+	$error      = 0;
156
+	$fuser      = check_authentication($authentication, $error, $errorcode, $errorlabel);
157
+
158
+	// Check parameters
159
+	if (empty($payment['amount']) && empty($payment['thirdparty_id'])) {
160
+		$error++;
161
+		$errorcode  ='KO';
162
+		$errorlabel ="You must specify the amount and the third party's ID.";
163
+	}
164
+
165
+	if (! $error)
166
+	{
167
+		$soc = new Societe($db);
168
+		$res = $soc->fetch($payment['thirdparty_id']);
169
+
170
+		$new_payment               = new Paiement($db);
171
+		$new_payment->amount       = doubleval($payment['amount']);
172
+		$new_payment->num_paiement = $payment['num_paiement'];
173
+		$new_payment->bank_account = intval($payment['bank_account']);
174
+		$new_payment->paiementid   = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id;
175
+		$new_payment->datepaye     = $now;
176
+		$new_payment->author       = $payment['thirdparty_id'];
177
+		$new_payment->amounts      = array();
178
+
179
+		if (intval($payment['invoice_id']) > 0) {
180
+			$new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount;
181
+		}
182
+
183
+		$db->begin();
184
+		$result = $new_payment->create($fuser, true);
185
+
186
+		if ($payment['bank_account']) {
187
+			$new_payment->addPaymentToBank($fuser, 'payment', $payment['int_label'], $payment['bank_account'], $payment['emitter'], $payment['bank_source']);
188
+		}
189
+
190
+		if ($result < 0)
191
+		{
192
+			$error++;
193
+		}
194
+
195
+		if (! $error)
196
+		{
197
+			$db->commit();
198
+			$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$new_payment->id);
199
+		}
200
+		else
201
+		{
202
+			$db->rollback();
203
+			$error++;
204
+			$errorcode='KO';
205
+			$errorlabel=$new_payment->error;
206
+			dol_syslog("Function: createInvoice error while creating".$errorlabel);
207
+		}
208
+	}
209
+
210
+	if ($error)
211
+	{
212
+		$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
213
+	}
214
+
215
+	return $objectresp;
216 216
 }
217 217
 
218 218
 // Return the results.
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
29 29
 
30 30
 require '../master.inc.php';
31
-require_once NUSOAP_PATH.'/nusoap.php';                // Include SOAP
31
+require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
32 32
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
33 33
 require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php';
34 34
 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
     'all',
69 69
     '',
70 70
     array(
71
-        'dolibarrkey'       => array('name'=>'dolibarrkey','type'=>'xsd:string'),
72
-       'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'),
73
-       'login'             => array('name'=>'login','type'=>'xsd:string'),
74
-        'password'          => array('name'=>'password','type'=>'xsd:string'),
75
-        'entity'            => array('name'=>'entity','type'=>'xsd:string')
71
+        'dolibarrkey'       => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
72
+       'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
73
+       'login'             => array('name'=>'login', 'type'=>'xsd:string'),
74
+        'password'          => array('name'=>'password', 'type'=>'xsd:string'),
75
+        'entity'            => array('name'=>'entity', 'type'=>'xsd:string')
76 76
     )
77 77
 );
78 78
 // Define WSDL Return object
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
     'all',
84 84
     '',
85 85
     array(
86
-        'result_code'  => array('name'=>'result_code','type'=>'xsd:string'),
87
-        'result_label' => array('name'=>'result_label','type'=>'xsd:string'),
86
+        'result_code'  => array('name'=>'result_code', 'type'=>'xsd:string'),
87
+        'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
88 88
     )
89 89
 );
90 90
 
@@ -96,32 +96,32 @@  discard block
 block discarded – undo
96 96
     'all',
97 97
     '',
98 98
     array(
99
-        'amount'          => array('name'=>'amount','type'=>'xsd:double'),
100
-        'num_paiement'    => array('name'=>'num_paiement','type'=>'xsd:string'),
101
-        'thirdparty_id'   => array('name'=>'thirdparty_id','type'=>'xsd:int'),
102
-               'bank_account'    => array('name'=>'bank_account','type'=>'xsd:int'),
103
-               'payment_mode_id' => array('name'=>'payment_mode_id','type'=>'xsd:int'),
104
-               'invoice_id'      => array('name'=>'invoice_id','type'=>'xsd:int'),
105
-               'int_label'       => array('name'=>'int_label','type'=>'xsd:string'),
106
-               'emitter'         => array('name'=>'emitter','type'=>'xsd:string'),
107
-               'bank_source'     => array('name'=>'bank_source','type'=>'xsd:string'),
99
+        'amount'          => array('name'=>'amount', 'type'=>'xsd:double'),
100
+        'num_paiement'    => array('name'=>'num_paiement', 'type'=>'xsd:string'),
101
+        'thirdparty_id'   => array('name'=>'thirdparty_id', 'type'=>'xsd:int'),
102
+               'bank_account'    => array('name'=>'bank_account', 'type'=>'xsd:int'),
103
+               'payment_mode_id' => array('name'=>'payment_mode_id', 'type'=>'xsd:int'),
104
+               'invoice_id'      => array('name'=>'invoice_id', 'type'=>'xsd:int'),
105
+               'int_label'       => array('name'=>'int_label', 'type'=>'xsd:string'),
106
+               'emitter'         => array('name'=>'emitter', 'type'=>'xsd:string'),
107
+               'bank_source'     => array('name'=>'bank_source', 'type'=>'xsd:string'),
108 108
     )
109 109
 );
110 110
 
111 111
 // 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped
112 112
 // Style merely dictates how to translate a WSDL binding to a SOAP message. Nothing more. You can use either style with any programming model.
113 113
 // http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
114
-$styledoc = 'rpc';       // rpc/document (document is an extend into SOAP 1.0 to support unstructured messages)
115
-$styleuse = 'encoded';   // encoded/literal/literal wrapped
114
+$styledoc = 'rpc'; // rpc/document (document is an extend into SOAP 1.0 to support unstructured messages)
115
+$styleuse = 'encoded'; // encoded/literal/literal wrapped
116 116
 // Better choice is document/literal wrapped but literal wrapped not supported by nusoap.
117 117
 
118 118
 // Register WSDL
119 119
 $server->register(
120 120
     'createPayment',
121 121
     // Entry values
122
-    array('authentication'=>'tns:authentication','payment'=>'tns:payment'),
122
+    array('authentication'=>'tns:authentication', 'payment'=>'tns:payment'),
123 123
     // Exit values
124
-    array('result'=>'tns:result','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'),
124
+    array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'),
125 125
     $ns,
126 126
     $ns.'#createPayment',
127 127
     $styledoc,
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
  */
140 140
 function createPayment($authentication, $payment)
141 141
 {
142
-    global $db,$conf,$langs;
142
+    global $db, $conf, $langs;
143 143
 
144 144
     $now = dol_now();
145 145
 
146 146
     dol_syslog("Function: createPayment login=".$authentication['login']." id=".$payment->id.
147 147
                ", ref=".$payment->ref.", ref_ext=".$payment->ref_ext);
148 148
 
149
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
149
+    if ($authentication['entity']) $conf->entity = $authentication['entity'];
150 150
 
151 151
     // Init and check authentication
152 152
     $objectresp = array();
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
     // Check parameters
159 159
     if (empty($payment['amount']) && empty($payment['thirdparty_id'])) {
160 160
         $error++;
161
-        $errorcode  ='KO';
162
-        $errorlabel ="You must specify the amount and the third party's ID.";
161
+        $errorcode  = 'KO';
162
+        $errorlabel = "You must specify the amount and the third party's ID.";
163 163
     }
164 164
 
165
-    if (! $error)
165
+    if (!$error)
166 166
     {
167 167
         $soc = new Societe($db);
168 168
         $res = $soc->fetch($payment['thirdparty_id']);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $new_payment->amounts      = array();
178 178
 
179 179
         if (intval($payment['invoice_id']) > 0) {
180
-            $new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount;
180
+            $new_payment->amounts[$payment['invoice_id']] = $new_payment->amount;
181 181
         }
182 182
 
183 183
         $db->begin();
@@ -192,17 +192,17 @@  discard block
 block discarded – undo
192 192
             $error++;
193 193
         }
194 194
 
195
-        if (! $error)
195
+        if (!$error)
196 196
         {
197 197
             $db->commit();
198
-            $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$new_payment->id);
198
+            $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$new_payment->id);
199 199
         }
200 200
         else
201 201
         {
202 202
             $db->rollback();
203 203
             $error++;
204
-            $errorcode='KO';
205
-            $errorlabel=$new_payment->error;
204
+            $errorcode = 'KO';
205
+            $errorlabel = $new_payment->error;
206 206
             dol_syslog("Function: createInvoice error while creating".$errorlabel);
207 207
         }
208 208
     }
Please login to merge, or discard this patch.
htdocs/core/ajax/security.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
 {
46 46
 	if ($_GET['action'] == 'getrandompassword' && $user->admin)
47 47
 	{
48
-        require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
49
-	    $generic = $_GET['generic'] ? true : false;
48
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
49
+		$generic = $_GET['generic'] ? true : false;
50 50
 		echo getRandomPassword($generic);
51 51
 	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  *                   like key to use into URL to protect them.
22 22
  */
23 23
 
24
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
25
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
26
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
27
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
28
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
29
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
24
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
25
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
26
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
27
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
28
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
29
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
30 30
 
31 31
 require '../../main.inc.php';
32 32
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
41 41
 
42 42
 // Registering the location of boxes
43
-if (isset($_GET['action']) && ! empty($_GET['action']))
43
+if (isset($_GET['action']) && !empty($_GET['action']))
44 44
 {
45 45
 	if ($_GET['action'] == 'getrandompassword' && $user->admin)
46 46
 	{
Please login to merge, or discard this patch.
Braces   +19 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,12 +21,25 @@
 block discarded – undo
21 21
  *                   like key to use into URL to protect them.
22 22
  */
23 23
 
24
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
25
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
26
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
27
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
28
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
29
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
24
+if (! defined('NOTOKENRENEWAL')) {
25
+	define('NOTOKENRENEWAL', '1');
26
+}
27
+// Disables token renewal
28
+if (! defined('NOREQUIREMENU')) {
29
+	define('NOREQUIREMENU', '1');
30
+}
31
+if (! defined('NOREQUIREHTML')) {
32
+	define('NOREQUIREHTML', '1');
33
+}
34
+if (! defined('NOREQUIREAJAX')) {
35
+	define('NOREQUIREAJAX', '1');
36
+}
37
+if (! defined('NOREQUIRESOC')) {
38
+	define('NOREQUIRESOC', '1');
39
+}
40
+if (! defined('NOREQUIRETRAN')) {
41
+	define('NOREQUIRETRAN', '1');
42
+}
30 43
 
31 44
 require '../../main.inc.php';
32 45
 
Please login to merge, or discard this patch.
htdocs/core/ajax/objectonoff.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,4 +46,4 @@
 block discarded – undo
46 46
 
47 47
 // Registering new values
48 48
 if (($action == 'set') && ! empty($id))
49
-    $object->setValueFrom($field, $value, $element, $id);
49
+	$object->setValueFrom($field, $value, $element, $id);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,26 +20,26 @@  discard block
 block discarded – undo
20 20
  *       			 This Ajax service is called when option MAIN_DIRECT_STATUS_UPDATE is set.
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
26
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
27
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
28
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
23
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
26
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
27
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
28
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
29 29
 
30 30
 require '../../main.inc.php';
31 31
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
32 32
 
33
-$action=GETPOST('action', 'alpha');
34
-$id=GETPOST('id', 'int');
35
-$value=GETPOST('value', 'int');
36
-$field=GETPOST('field', 'alpha');
37
-$element=GETPOST('element', 'alpha');
33
+$action = GETPOST('action', 'alpha');
34
+$id = GETPOST('id', 'int');
35
+$value = GETPOST('value', 'int');
36
+$field = GETPOST('field', 'alpha');
37
+$element = GETPOST('element', 'alpha');
38 38
 
39 39
 $object = new GenericObject($db);
40 40
 
41 41
 // Security check
42
-if (! empty($user->socid))
42
+if (!empty($user->socid))
43 43
 	$socid = $user->socid;
44 44
 
45 45
 
@@ -67,5 +67,5 @@  discard block
 block discarded – undo
67 67
 }
68 68
 
69 69
 // Registering new values
70
-if (($action == 'set') && ! empty($id))
70
+if (($action == 'set') && !empty($id))
71 71
     $object->setValueFrom($field, $value, $element, $id);
Please login to merge, or discard this patch.
Braces   +25 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,12 +20,25 @@  discard block
 block discarded – undo
20 20
  *       			 This Ajax service is called when option MAIN_DIRECT_STATUS_UPDATE is set.
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
26
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
27
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
28
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
23
+if (! defined('NOTOKENRENEWAL')) {
24
+	define('NOTOKENRENEWAL', '1');
25
+}
26
+// Disables token renewal
27
+if (! defined('NOREQUIREMENU')) {
28
+	define('NOREQUIREMENU', '1');
29
+}
30
+if (! defined('NOREQUIREHTML')) {
31
+	define('NOREQUIREHTML', '1');
32
+}
33
+if (! defined('NOREQUIREAJAX')) {
34
+	define('NOREQUIREAJAX', '1');
35
+}
36
+if (! defined('NOREQUIRESOC')) {
37
+	define('NOREQUIRESOC', '1');
38
+}
39
+if (! defined('NOREQUIRETRAN')) {
40
+	define('NOREQUIRETRAN', '1');
41
+}
29 42
 
30 43
 require '../../main.inc.php';
31 44
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
@@ -39,8 +52,9 @@  discard block
 block discarded – undo
39 52
 $object = new GenericObject($db);
40 53
 
41 54
 // Security check
42
-if (! empty($user->socid))
55
+if (! empty($user->socid)) {
43 56
 	$socid = $user->socid;
57
+}
44 58
 
45 59
 
46 60
 
@@ -55,17 +69,16 @@  discard block
 block discarded – undo
55 69
 if ($element == 'societe' && in_array($field, array('status')))
56 70
 {
57 71
 	$result = restrictedArea($user, 'societe', $id);
58
-}
59
-elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch')))
72
+} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch')))
60 73
 {
61 74
 	$result = restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
62
-}
63
-else
75
+} else
64 76
 {
65 77
 	accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
66 78
 	exit;
67 79
 }
68 80
 
69 81
 // Registering new values
70
-if (($action == 'set') && ! empty($id))
82
+if (($action == 'set') && ! empty($id)) {
71 83
     $object->setValueFrom($field, $value, $element, $id);
84
+}
Please login to merge, or discard this patch.