Passed
Branch develop (230fe2)
by
unknown
30:24
created
htdocs/core/js/lib_notification.js.php 2 patches
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,13 +18,27 @@
 block discarded – undo
18 18
  * Library javascript to enable Browser notifications
19 19
  */
20 20
 
21
-if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
22
-if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
23
-if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
24
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
25
-if (!defined('NOLOGIN')) define('NOLOGIN', 1);
26
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
27
-if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
21
+if (!defined('NOREQUIREUSER')) {
22
+	define('NOREQUIREUSER', '1');
23
+}
24
+if (!defined('NOREQUIRESOC')) {
25
+	define('NOREQUIRESOC', '1');
26
+}
27
+if (!defined('NOCSRFCHECK')) {
28
+	define('NOCSRFCHECK', 1);
29
+}
30
+if (!defined('NOTOKENRENEWAL')) {
31
+	define('NOTOKENRENEWAL', 1);
32
+}
33
+if (!defined('NOLOGIN')) {
34
+	define('NOLOGIN', 1);
35
+}
36
+if (!defined('NOREQUIREMENU')) {
37
+	define('NOREQUIREMENU', 1);
38
+}
39
+if (!defined('NOREQUIREHTML')) {
40
+	define('NOREQUIREHTML', 1);
41
+}
28 42
 
29 43
 require_once '../../main.inc.php';
30 44
 
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@
 block discarded – undo
30 30
 require_once '../../main.inc.php';
31 31
 
32 32
 if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/index.php'
33
-    || preg_match('/getmenu_div\.php/', $_SERVER['HTTP_REFERER'])))
33
+	|| preg_match('/getmenu_div\.php/', $_SERVER['HTTP_REFERER'])))
34 34
 {
35
-    global $langs, $conf;
35
+	global $langs, $conf;
36 36
 
37
-    top_httphead('text/javascript; charset=UTF-8');
37
+	top_httphead('text/javascript; charset=UTF-8');
38 38
 
39
-    print 'var login = \''.$_SESSION['dol_login'].'\';'."\n";
40
-    print 'var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined
41
-    print 'var time_js_next_test = (Date.now() + time_auto_update);'."\n";
42
-    ?>
39
+	print 'var login = \''.$_SESSION['dol_login'].'\';'."\n";
40
+	print 'var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined
41
+	print 'var time_js_next_test = (Date.now() + time_auto_update);'."\n";
42
+	?>
43 43
 
44 44
 	/* Check if permission ok */
45 45
 	if (Notification.permission !== "granted") {
Please login to merge, or discard this patch.
htdocs/core/modules/project/task/modules_task.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,9 +133,15 @@
 block discarded – undo
133 133
 		global $langs;
134 134
 		$langs->load("admin");
135 135
 
136
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
137
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
138
-		if ($this->version == 'dolibarr') return DOL_VERSION;
136
+		if ($this->version == 'development') {
137
+			return $langs->trans("VersionDevelopment");
138
+		}
139
+		if ($this->version == 'experimental') {
140
+			return $langs->trans("VersionExperimental");
141
+		}
142
+		if ($this->version == 'dolibarr') {
143
+			return DOL_VERSION;
144
+		}
139 145
 		return $langs->trans("NotAvailable");
140 146
 	}
141 147
 }
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 	public $error = '';
39 39
 
40 40
 
41
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
41
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
42 42
 	/**
43 43
 	 *  Return list of active generation modules
44 44
 	 *
45
-     *  @param	DoliDB	$db     			Database handler
46
-     *  @param  integer	$maxfilenamelength  Max length of value to show
47
-     *  @return	array						List of templates
48
-     */
49
-    public static function liste_modeles($db, $maxfilenamelength = 0)
45
+	 *  @param	DoliDB	$db     			Database handler
46
+	 *  @param  integer	$maxfilenamelength  Max length of value to show
47
+	 *  @return	array						List of templates
48
+	 */
49
+	public static function liste_modeles($db, $maxfilenamelength = 0)
50 50
 	{
51
-        // phpcs:enable
51
+		// phpcs:enable
52 52
 		global $conf;
53 53
 
54 54
 		$type = 'project_task';
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 *  @return		boolean     true if module can be used
80 80
 	 */
81
-    public function isEnabled()
81
+	public function isEnabled()
82 82
 	{
83 83
 		return true;
84 84
 	}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 *  @return     string      Texte descripif
90 90
 	 */
91
-    public function info()
91
+	public function info()
92 92
 	{
93 93
 		global $langs;
94 94
 		$langs->load("projects");
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 *  @return     string      Example
102 102
 	 */
103
-    public function getExample()
103
+	public function getExample()
104 104
 	{
105 105
 		global $langs;
106 106
 		$langs->load("projects");
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 *  @return     boolean     false if conflict, true if ok
115 115
 	 */
116
-    public function canBeActivated()
116
+	public function canBeActivated()
117 117
 	{
118 118
 		return true;
119 119
 	}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 *	@param	Project		$project	Object project
126 126
 	 *	@return	string					Valeur
127 127
 	 */
128
-    public function getNextValue($objsoc, $project)
128
+	public function getNextValue($objsoc, $project)
129 129
 	{
130 130
 		global $langs;
131 131
 		return $langs->trans("NotAvailable");
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 *  @return     string      Valeur
138 138
 	 */
139
-    public function getVersion()
139
+	public function getVersion()
140 140
 	{
141 141
 		global $langs;
142 142
 		$langs->load("admin");
Please login to merge, or discard this patch.
htdocs/core/modules/modMultiCurrency.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -309,7 +309,9 @@
 block discarded – undo
309 309
 			$multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')';
310 310
 			$r = $multicurrency->create($user);
311 311
 			
312
-			if ($r > 0)	$multicurrency->addRate(1);
312
+			if ($r > 0) {
313
+				$multicurrency->addRate(1);
314
+			}
313 315
 		}
314 316
 	}
315 317
 }
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param DoliDB $db Database handler
40 40
 	 */
41
-    public function __construct($db)
42
-    {
43
-        global $langs, $conf;
41
+	public function __construct($db)
42
+	{
43
+		global $langs, $conf;
44 44
 
45
-        $this->db = $db;
45
+		$this->db = $db;
46 46
 
47 47
 		// Id for module (must be unique).
48 48
 		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 
102 102
 		// Array to add new pages in new tabs
103 103
 		// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@multicurrency:$user->rights->multicurrency->read:/multicurrency/mynewtab1.php?id=__ID__',  					// To add a new tab identified by code tabname1
104
-        //                              'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@multicurrency:$user->rights->othermodule->read:/multicurrency/mynewtab2.php?id=__ID__',  	// To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
105
-        //                              'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
104
+		//                              'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@multicurrency:$user->rights->othermodule->read:/multicurrency/mynewtab2.php?id=__ID__',  	// To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
105
+		//                              'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
106 106
 		// where objecttype can be
107 107
 		// 'categories_x'	  to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
108 108
 		// 'contact'          to add a tab in contact view
@@ -123,16 +123,16 @@  discard block
 block discarded – undo
123 123
 		// 'stock'            to add a tab in stock view
124 124
 		// 'thirdparty'       to add a tab in third party view
125 125
 		// 'user'             to add a tab in user view
126
-        $this->tabs = array();
127
-
128
-        // Dictionaries
129
-	    if (!isset($conf->multicurrency->enabled))
130
-        {
131
-        	$conf->multicurrency = new stdClass();
132
-        	$conf->multicurrency->enabled = 0;
133
-        }
126
+		$this->tabs = array();
127
+
128
+		// Dictionaries
129
+		if (!isset($conf->multicurrency->enabled))
130
+		{
131
+			$conf->multicurrency = new stdClass();
132
+			$conf->multicurrency->enabled = 0;
133
+		}
134 134
 		$this->dictionaries = array();
135
-        /* Example:
135
+		/* Example:
136 136
         if (! isset($conf->multicurrency->enabled)) $conf->multicurrency->enabled=0;	// This is to avoid warnings
137 137
         $this->dictionaries=array(
138 138
             'langs'=>'mylangfile@multicurrency',
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
         );
150 150
         */
151 151
 
152
-        // Boxes
152
+		// Boxes
153 153
 		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
154
-        $this->boxes = array(); // List of boxes
154
+		$this->boxes = array(); // List of boxes
155 155
 		// Example:
156 156
 		//$this->boxes=array(
157 157
 		//    0=>array('file'=>'myboxa.php@multicurrency','note'=>'','enabledbydefaulton'=>'Home'),
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 		// Example:
216 216
 		// $this->export_code[$r]=$this->rights_class.'_'.$r;
217 217
 		// $this->export_label[$r]='MyModule';	// Translation key (used only if key ExportDataset_xxx_z not found)
218
-        // $this->export_enabled[$r]='1';                               // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
219
-        // $this->export_icon[$r]='generic:MyModule';
218
+		// $this->export_enabled[$r]='1';                               // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
219
+		// $this->export_icon[$r]='generic:MyModule';
220 220
 		// $this->export_permission[$r]=array(array("multicurrency","level1","level2"));
221 221
 		// $this->export_fields_array[$r]=array(
222 222
 		//	's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
260 260
 	 *		It also creates data directories
261 261
 	 *
262
-     *      @param      string	$options    Options when enabling module ('', 'noboxes')
262
+	 *      @param      string	$options    Options when enabling module ('', 'noboxes')
263 263
 	 *      @return     int             	1 if OK, 0 if KO
264 264
 	 */
265 265
 	public function init($options = '')
Please login to merge, or discard this patch.
htdocs/core/lib/parsemd.lib.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 block discarded – undo
45 45
         include_once DOL_DOCUMENT_ROOT.'/includes/parsedown/Parsedown.php';
46 46
         $Parsedown = new Parsedown();
47 47
         $content = $Parsedown->text($content);
48
-    }
49
-    else
48
+    } else
50 49
     {
51 50
         $content = nl2br($content);
52 51
     }
Please login to merge, or discard this patch.
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function dolMd2Html($content, $parser = 'parsedown', $replaceimagepath = null)
33 33
 {
34
-    if (is_array($replaceimagepath))
35
-    {
36
-        foreach ($replaceimagepath as $key => $val)
37
-        {
38
-            $keytoreplace = ']('.$key;
39
-            $valafter = ']('.$val;
40
-            $content = preg_replace('/'.preg_quote($keytoreplace, '/').'/m', $valafter, $content);
41
-        }
42
-    }
43
-    if ($parser == 'parsedown')
44
-    {
45
-        include_once DOL_DOCUMENT_ROOT.'/includes/parsedown/Parsedown.php';
46
-        $Parsedown = new Parsedown();
47
-        $content = $Parsedown->text($content);
48
-    }
49
-    else
50
-    {
51
-        $content = nl2br($content);
52
-    }
34
+	if (is_array($replaceimagepath))
35
+	{
36
+		foreach ($replaceimagepath as $key => $val)
37
+		{
38
+			$keytoreplace = ']('.$key;
39
+			$valafter = ']('.$val;
40
+			$content = preg_replace('/'.preg_quote($keytoreplace, '/').'/m', $valafter, $content);
41
+		}
42
+	}
43
+	if ($parser == 'parsedown')
44
+	{
45
+		include_once DOL_DOCUMENT_ROOT.'/includes/parsedown/Parsedown.php';
46
+		$Parsedown = new Parsedown();
47
+		$content = $Parsedown->text($content);
48
+	}
49
+	else
50
+	{
51
+		$content = nl2br($content);
52
+	}
53 53
 
54
-    return $content;
54
+	return $content;
55 55
 }
56 56
 
57 57
 
@@ -65,23 +65,23 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function dolMd2Asciidoc($content, $parser = 'dolibarr', $replaceimagepath = null)
67 67
 {
68
-    if (is_array($replaceimagepath))
69
-    {
70
-        foreach ($replaceimagepath as $key => $val)
71
-        {
72
-            $keytoreplace = ']('.$key;
73
-            $valafter = ']('.$val;
74
-            $content = preg_replace('/'.preg_quote($keytoreplace, '/').'/m', $valafter, $content);
75
-        }
76
-    }
77
-    //if ($parser == 'dolibarr')
78
-    //{
79
-        $content = preg_replace('/<!--.*-->/msU', '', $content);
80
-    //}
81
-    //else
82
-    //{
83
-    //    $content = $content;
84
-    //}
68
+	if (is_array($replaceimagepath))
69
+	{
70
+		foreach ($replaceimagepath as $key => $val)
71
+		{
72
+			$keytoreplace = ']('.$key;
73
+			$valafter = ']('.$val;
74
+			$content = preg_replace('/'.preg_quote($keytoreplace, '/').'/m', $valafter, $content);
75
+		}
76
+	}
77
+	//if ($parser == 'dolibarr')
78
+	//{
79
+		$content = preg_replace('/<!--.*-->/msU', '', $content);
80
+	//}
81
+	//else
82
+	//{
83
+	//    $content = $content;
84
+	//}
85 85
 
86
-    return $content;
86
+	return $content;
87 87
 }
Please login to merge, or discard this patch.
htdocs/don/payment/payment.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,8 +132,7 @@  discard block
 block discarded – undo
132 132
                 $loc = DOL_URL_ROOT.'/don/card.php?rowid='.$chid;
133 133
                 header('Location: '.$loc);
134 134
                 exit;
135
-            }
136
-            else
135
+            } else
137 136
             {
138 137
                 $db->rollback();
139 138
             }
@@ -272,8 +271,7 @@  discard block
 block discarded – undo
272 271
 		{
273 272
 			$namef = "amount_".$objp->id;
274 273
 			print '<input type="text" size="8" name="'.$namef.'">';
275
-		}
276
-		else
274
+		} else
277 275
 		{
278 276
 			print '-';
279 277
 		}
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
70 70
 		$error++;
71 71
 	}
72
-    if (!empty($conf->banque->enabled) && !$_POST["accountid"] > 0)
73
-    {
74
-    	setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
75
-        $error++;
76
-    }
72
+	if (!empty($conf->banque->enabled) && !$_POST["accountid"] > 0)
73
+	{
74
+		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
75
+		$error++;
76
+	}
77 77
 
78 78
 	if (!$error)
79 79
 	{
@@ -89,60 +89,60 @@  discard block
 block discarded – undo
89 89
 			}
90 90
 		}
91 91
 
92
-        if (count($amounts) <= 0)
93
-        {
94
-            $error++;
95
-            $errmsg = 'ErrorNoPaymentDefined';
96
-            setEventMessages($errmsg, null, 'errors');
97
-        }
98
-
99
-        if (!$error)
100
-        {
101
-    		$db->begin();
102
-
103
-    		// Create a line of payments
104
-    		$payment = new PaymentDonation($db);
105
-    		$payment->chid         = $chid;
106
-    		$payment->datepaid     = $datepaid;
107
-    		$payment->amounts      = $amounts; // Tableau de montant
108
-    		$payment->paymenttype  = GETPOST("paymenttype", 'int');
109
-    		$payment->num_payment  = GETPOST("num_payment", 'alphanohtml');
110
-    		$payment->note_public  = GETPOST("note_public", 'none');
111
-
112
-    		if (!$error)
113
-    		{
114
-    		    $paymentid = $payment->create($user);
115
-                if ($paymentid < 0)
116
-                {
117
-                    $errmsg = $payment->error;
118
-                    setEventMessages($errmsg, null, 'errors');
119
-                    $error++;
120
-                }
121
-    		}
122
-
123
-            if (!$error)
124
-            {
125
-                $result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', '');
126
-                if (!$result > 0)
127
-                {
128
-                    $errmsg = $payment->error;
129
-                    setEventMessages($errmsg, null, 'errors');
130
-                    $error++;
131
-                }
132
-            }
133
-
134
-    	    if (!$error)
135
-            {
136
-                $db->commit();
137
-                $loc = DOL_URL_ROOT.'/don/card.php?rowid='.$chid;
138
-                header('Location: '.$loc);
139
-                exit;
140
-            }
141
-            else
142
-            {
143
-                $db->rollback();
144
-            }
145
-        }
92
+		if (count($amounts) <= 0)
93
+		{
94
+			$error++;
95
+			$errmsg = 'ErrorNoPaymentDefined';
96
+			setEventMessages($errmsg, null, 'errors');
97
+		}
98
+
99
+		if (!$error)
100
+		{
101
+			$db->begin();
102
+
103
+			// Create a line of payments
104
+			$payment = new PaymentDonation($db);
105
+			$payment->chid         = $chid;
106
+			$payment->datepaid     = $datepaid;
107
+			$payment->amounts      = $amounts; // Tableau de montant
108
+			$payment->paymenttype  = GETPOST("paymenttype", 'int');
109
+			$payment->num_payment  = GETPOST("num_payment", 'alphanohtml');
110
+			$payment->note_public  = GETPOST("note_public", 'none');
111
+
112
+			if (!$error)
113
+			{
114
+				$paymentid = $payment->create($user);
115
+				if ($paymentid < 0)
116
+				{
117
+					$errmsg = $payment->error;
118
+					setEventMessages($errmsg, null, 'errors');
119
+					$error++;
120
+				}
121
+			}
122
+
123
+			if (!$error)
124
+			{
125
+				$result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', '');
126
+				if (!$result > 0)
127
+				{
128
+					$errmsg = $payment->error;
129
+					setEventMessages($errmsg, null, 'errors');
130
+					$error++;
131
+				}
132
+			}
133
+
134
+			if (!$error)
135
+			{
136
+				$db->commit();
137
+				$loc = DOL_URL_ROOT.'/don/card.php?rowid='.$chid;
138
+				header('Location: '.$loc);
139
+				exit;
140
+			}
141
+			else
142
+			{
143
+				$db->rollback();
144
+			}
145
+		}
146 146
 	}
147 147
 
148 148
 	$action = 'create';
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	print '<input type="hidden" name="chid" value="'.$chid.'">';
186 186
 	print '<input type="hidden" name="action" value="add_payment">';
187 187
 
188
-    dol_fiche_head();
188
+	dol_fiche_head();
189 189
 
190 190
 	print '<table class="border centpercent tableforfieldcreate">';
191 191
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
 	print '</table>';
222 222
 
223
-    dol_fiche_end();
223
+	dol_fiche_end();
224 224
 
225 225
 	/*
226 226
  	 * List of payments on donation
Please login to merge, or discard this patch.
htdocs/variants/class/ProductAttribute.class.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,8 +115,9 @@
 block discarded – undo
115 115
     
116 116
     			$return[] = $tmp;
117 117
     		}
118
+		} else {
119
+			dol_print_error($this->db);
118 120
 		}
119
-		else dol_print_error($this->db);
120 121
 		
121 122
 		return $return;
122 123
 	}
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public $rang;
55 55
 
56
-    /**
57
-     * Constructor
58
-     *
59
-     * @param   DoliDB $db     Database handler
60
-     */
56
+	/**
57
+	 * Constructor
58
+	 *
59
+	 * @param   DoliDB $db     Database handler
60
+	 */
61 61
 	public function __construct(DoliDB $db)
62 62
 	{
63 63
 		global $conf;
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 		$query = $this->db->query($sql);
111 111
 		if ($query)
112 112
 		{
113
-    		while ($result = $this->db->fetch_object($query)) {
114
-    			$tmp = new ProductAttribute($this->db);
115
-    			$tmp->id = $result->rowid;
116
-    			$tmp->ref = $result->ref;
117
-    			$tmp->label = $result->label;
118
-    			$tmp->rang = $result->rang;
119
-
120
-    			$return[] = $tmp;
121
-    		}
113
+			while ($result = $this->db->fetch_object($query)) {
114
+				$tmp = new ProductAttribute($this->db);
115
+				$tmp->id = $result->rowid;
116
+				$tmp->ref = $result->ref;
117
+				$tmp->label = $result->label;
118
+				$tmp->rang = $result->rang;
119
+
120
+				$return[] = $tmp;
121
+			}
122 122
 		}
123 123
 		else dol_print_error($this->db);
124 124
 
Please login to merge, or discard this patch.
htdocs/variants/class/ProductCombination.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,9 @@
 block discarded – undo
190 190
 	    $resql = $this->db->query($sql);
191 191
 	    if ($resql) {
192 192
 	        $obj = $this->db->fetch_object($resql);
193
-	        if ($obj) $nb = $obj->nb;
193
+	        if ($obj) {
194
+	        	$nb = $obj->nb;
195
+	        }
194 196
 	    }
195 197
 
196 198
 	    return $nb;
Please login to merge, or discard this patch.
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public $entity;
73 73
 
74
-    /**
75
-     * Constructor
76
-     *
77
-     * @param   DoliDB $db     Database handler
78
-     */
79
-    public function __construct(DoliDB $db)
74
+	/**
75
+	 * Constructor
76
+	 *
77
+	 * @param   DoliDB $db     Database handler
78
+	 */
79
+	public function __construct(DoliDB $db)
80 80
 	{
81 81
 		global $conf;
82 82
 
@@ -189,16 +189,16 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function countNbOfCombinationForFkProductParent($fk_product_parent)
191 191
 	{
192
-	    $nb = 0;
193
-	    $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")";
192
+		$nb = 0;
193
+		$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")";
194 194
 
195
-	    $resql = $this->db->query($sql);
196
-	    if ($resql) {
197
-	        $obj = $this->db->fetch_object($resql);
198
-	        if ($obj) $nb = $obj->nb;
199
-	    }
195
+		$resql = $this->db->query($sql);
196
+		if ($resql) {
197
+			$obj = $this->db->fetch_object($resql);
198
+			if ($obj) $nb = $obj->nb;
199
+		}
200 200
 
201
-	    return $nb;
201
+		return $nb;
202 202
 	}
203 203
 
204 204
 	/**
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 				$newproduct->ref = $forced_refvar;
528 528
 			}
529 529
 		} else {
530
-		    $forced_refvar = false;
531
-		    $existingProduct = false;
532
-            $newproduct = clone $product;
530
+			$forced_refvar = false;
531
+			$existingProduct = false;
532
+			$newproduct = clone $product;
533 533
 		}
534 534
 
535 535
 		//Final weight impact
@@ -590,11 +590,11 @@  discard block
 block discarded – undo
590 590
 			}
591 591
 
592 592
 			if ($forced_refvar === false) {
593
-    			if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
593
+				if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
594 594
 					$newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR.$prodattrval->ref;
595
-    			} else {
595
+				} else {
596 596
 					$newproduct->ref .= '_'.$prodattrval->ref;
597
-    			}
597
+				}
598 598
 			}
599 599
 
600 600
 			//The first one should not contain a linebreak
@@ -613,62 +613,62 @@  discard block
 block discarded – undo
613 613
 		// Now create the product
614 614
 		//print 'Create prod '.$newproduct->ref.'<br>'."\n";
615 615
 		if ($existingProduct === false) {
616
-    		//To avoid wrong information in price history log
617
-    		$newproduct->price = 0;
618
-    		$newproduct->price_ttc = 0;
619
-    		$newproduct->price_min = 0;
620
-    		$newproduct->price_min_ttc = 0;
621
-
622
-    		// A new variant must use a new barcode (not same product)
623
-    		$newproduct->barcode = -1;
624
-		    $result = $newproduct->create($user);
625
-
626
-    		if ($result < 0)
627
-    		{
628
-    			//In case the error is not related with an already existing product
629
-    			if ($newproduct->error != 'ErrorProductAlreadyExists') {
630
-    			    $this->error[] = $newproduct->error;
631
-    			    $this->errors = $newproduct->errors;
632
-    				$db->rollback();
633
-    				return -1;
634
-    			}
635
-
636
-    			/**
637
-    			 * If there is an existing combination, then we update the prices and weight
638
-    			 * Otherwise, we try adding a random number to the ref
639
-    			 */
640
-
641
-    			if ($newcomb->fk_product_child) {
642
-    				$res = $newproduct->fetch($existingCombination->fk_product_child);
643
-    			} else {
644
-    				$orig_prod_ref = $newproduct->ref;
645
-    				$i = 1;
646
-
647
-    				do {
648
-    					$newproduct->ref = $orig_prod_ref.$i;
649
-    					$res = $newproduct->create($user);
650
-
651
-    					if ($newproduct->error != 'ErrorProductAlreadyExists') {
652
-    					    $this->errors[] = $newproduct->error;
653
-    						break;
654
-    					}
655
-
656
-    					$i++;
657
-    				} while ($res < 0);
658
-    			}
659
-
660
-    			if ($res < 0) {
661
-    				$db->rollback();
662
-    				return -1;
663
-    			}
664
-    		}
616
+			//To avoid wrong information in price history log
617
+			$newproduct->price = 0;
618
+			$newproduct->price_ttc = 0;
619
+			$newproduct->price_min = 0;
620
+			$newproduct->price_min_ttc = 0;
621
+
622
+			// A new variant must use a new barcode (not same product)
623
+			$newproduct->barcode = -1;
624
+			$result = $newproduct->create($user);
625
+
626
+			if ($result < 0)
627
+			{
628
+				//In case the error is not related with an already existing product
629
+				if ($newproduct->error != 'ErrorProductAlreadyExists') {
630
+					$this->error[] = $newproduct->error;
631
+					$this->errors = $newproduct->errors;
632
+					$db->rollback();
633
+					return -1;
634
+				}
635
+
636
+				/**
637
+				 * If there is an existing combination, then we update the prices and weight
638
+				 * Otherwise, we try adding a random number to the ref
639
+				 */
640
+
641
+				if ($newcomb->fk_product_child) {
642
+					$res = $newproduct->fetch($existingCombination->fk_product_child);
643
+				} else {
644
+					$orig_prod_ref = $newproduct->ref;
645
+					$i = 1;
646
+
647
+					do {
648
+						$newproduct->ref = $orig_prod_ref.$i;
649
+						$res = $newproduct->create($user);
650
+
651
+						if ($newproduct->error != 'ErrorProductAlreadyExists') {
652
+							$this->errors[] = $newproduct->error;
653
+							break;
654
+						}
655
+
656
+						$i++;
657
+					} while ($res < 0);
658
+				}
659
+
660
+				if ($res < 0) {
661
+					$db->rollback();
662
+					return -1;
663
+				}
664
+			}
665 665
 		} else {
666
-		    $result = $newproduct->update($newproduct->id, $user);
667
-		    if ($result < 0)
668
-		    {
669
-		        $db->rollback();
670
-		        return -1;
671
-		    }
666
+			$result = $newproduct->update($newproduct->id, $user);
667
+			if ($result < 0)
668
+			{
669
+				$db->rollback();
670
+				return -1;
671
+			}
672 672
 		}
673 673
 
674 674
 		$newcomb->fk_product_child = $newproduct->id;
@@ -683,14 +683,14 @@  discard block
 block discarded – undo
683 683
 		return $newproduct->id;
684 684
 	}
685 685
 
686
-    /**
687
-     * Copies all product combinations from the origin product to the destination product
688
-     *
686
+	/**
687
+	 * Copies all product combinations from the origin product to the destination product
688
+	 *
689 689
 	 * @param 	User 	$user	Object user
690
-     * @param   int     $origProductId  Origin product id
691
-     * @param   Product $destProduct    Destination product
692
-     * @return  int                     >0 OK <0 KO
693
-     */
690
+	 * @param   int     $origProductId  Origin product id
691
+	 * @param   Product $destProduct    Destination product
692
+	 * @return  int                     >0 OK <0 KO
693
+	 */
694 694
 	public function copyAll(User $user, $origProductId, Product $destProduct)
695 695
 	{
696 696
 		require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 				$variations[$tmp_pc2v->fk_prod_attr] = $tmp_pc2v->fk_prod_attr_val;
713 713
 			}
714 714
 
715
-            if ($this->createProductCombination(
715
+			if ($this->createProductCombination(
716 716
 				$user,
717 717
 				$destProduct,
718 718
 				$variations,
Please login to merge, or discard this patch.
htdocs/margin/lib/margins.lib.php 2 patches
Braces   +13 added lines, -12 removed lines patch added patch discarded remove patch
@@ -124,13 +124,11 @@  discard block
 block discarded – undo
124 124
 		if ($product->fetch_product_fournisseur_price($fk_pa))
125 125
 		{
126 126
 			$paht_ret = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
127
-		}
128
-		else
127
+		} else
129 128
 		{
130 129
 			$paht_ret = $paht;
131 130
 		}
132
-	}
133
-	else
131
+	} else
134 132
 	{
135 133
 		$paht_ret = $paht;
136 134
 	}
@@ -142,17 +140,20 @@  discard block
 block discarded – undo
142 140
 	$pu_ht_remise = price2num($pu_ht_remise, 'MU');
143 141
 
144 142
 	// calcul marge
145
-	if ($pu_ht_remise < 0)
146
-		$marge = -1 * (abs($pu_ht_remise) - $paht_ret);
147
-	else
148
-		$marge = $pu_ht_remise - $paht_ret;
143
+	if ($pu_ht_remise < 0) {
144
+			$marge = -1 * (abs($pu_ht_remise) - $paht_ret);
145
+	} else {
146
+			$marge = $pu_ht_remise - $paht_ret;
147
+	}
149 148
 
150 149
 	// calcul taux marge
151
-	if ($paht_ret != 0)
152
-		$marge_tx_ret = (100 * $marge) / $paht_ret;
150
+	if ($paht_ret != 0) {
151
+			$marge_tx_ret = (100 * $marge) / $paht_ret;
152
+	}
153 153
 	// calcul taux marque
154
-	if ($pu_ht_remise != 0)
155
-		$marque_tx_ret = (100 * $marge) / $pu_ht_remise;
154
+	if ($pu_ht_remise != 0) {
155
+			$marque_tx_ret = (100 * $marge) / $pu_ht_remise;
156
+	}
156 157
 
157 158
 	return array($paht_ret, $marge_tx_ret, $marque_tx_ret);
158 159
 }
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
 
43 43
 	// Show more tabs from modules
44 44
 	// Entries must be declared in modules descriptor with line
45
-    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
46
-    // $this->tabs = array('entity:-tabname);   												to remove a tab
45
+	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
46
+	// $this->tabs = array('entity:-tabname);   												to remove a tab
47 47
 	complete_head_from_modules($conf, $langs, '', $head, $h, 'margesadmin');
48 48
 
49 49
 	complete_head_from_modules($conf, $langs, '', $head, $h, 'margesadmin', 'remove');
Please login to merge, or discard this patch.
htdocs/cashdesk/affContenu.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 // Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
35 35
 if (isset($_SESSION['serObjFacturation']))
36 36
 {
37
-    $obj_facturation = unserialize($_SESSION['serObjFacturation']);
38
-    unset($_SESSION['serObjFacturation']);
37
+	$obj_facturation = unserialize($_SESSION['serObjFacturation']);
38
+	unset($_SESSION['serObjFacturation']);
39 39
 }
40 40
 else
41 41
 {
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
 {
37 37
     $obj_facturation = unserialize($_SESSION['serObjFacturation']);
38 38
     unset($_SESSION['serObjFacturation']);
39
-}
40
-else
39
+} else
41 40
 {
42 41
 	// ... sinon, c'est une nouvelle vente
43 42
 	$obj_facturation = new Facturation();
@@ -60,7 +59,9 @@  discard block
 block discarded – undo
60 59
 print '<div class="principal">';
61 60
 
62 61
 $page = GETPOST('menutpl', 'alpha');
63
-if (empty($page)) $page = 'facturation';
62
+if (empty($page)) {
63
+	$page = 'facturation';
64
+}
64 65
 
65 66
 if (in_array(
66 67
 		$page,
@@ -72,8 +73,7 @@  discard block
 block discarded – undo
72 73
 	))
73 74
 {
74 75
 	include $page.'.php';
75
-}
76
-else
76
+} else
77 77
 {
78 78
 	dol_print_error('', 'menu param '.$page.' is not inside allowed list');
79 79
 }
Please login to merge, or discard this patch.