Passed
Push — master ( 222e44...208bd5 )
by Alxarafe
31:22
created
dolibarr/htdocs/core/boxes/box_graph_orders_permonth.php 3 patches
Indentation   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -28,254 +28,254 @@
 block discarded – undo
28 28
  */
29 29
 class box_graph_orders_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="orderspermonth";
32
-	var $boximg="object_order";
33
-	var $boxlabel="BoxCustomersOrdersPerMonth";
34
-	var $depends = array("commande");
31
+    var $boxcode="orderspermonth";
32
+    var $boximg="object_order";
33
+    var $boxlabel="BoxCustomersOrdersPerMonth";
34
+    var $depends = array("commande");
35 35
 
36
-	/**
36
+    /**
37 37
      * @var DoliDB Database handler.
38 38
      */
39 39
     public $db;
40 40
 
41
-	var $info_box_head = array();
42
-	var $info_box_contents = array();
41
+    var $info_box_head = array();
42
+    var $info_box_contents = array();
43 43
 
44 44
 
45
-	/**
46
-	 *  Constructor
47
-	 *
48
-	 * 	@param	DoliDB	$db			Database handler
49
-	 *  @param	string	$param		More parameters
50
-	 */
51
-	function __construct($db,$param)
52
-	{
53
-		global $user;
45
+    /**
46
+     *  Constructor
47
+     *
48
+     * 	@param	DoliDB	$db			Database handler
49
+     *  @param	string	$param		More parameters
50
+     */
51
+    function __construct($db,$param)
52
+    {
53
+        global $user;
54 54
 
55
-		$this->db=$db;
55
+        $this->db=$db;
56 56
 
57
-		$this->hidden = ! ($user->rights->commande->lire);
58
-	}
57
+        $this->hidden = ! ($user->rights->commande->lire);
58
+    }
59 59
 
60
-	/**
61
-	 *  Load data into info_box_contents array to show array later.
62
-	 *
63
-	 *  @param	int		$max        Maximum number of records to load
60
+    /**
61
+     *  Load data into info_box_contents array to show array later.
62
+     *
63
+     *  @param	int		$max        Maximum number of records to load
64 64
      *  @return	void
65
-	 */
66
-	function loadBox($max=5)
67
-	{
68
-		global $conf, $user, $langs, $db;
65
+     */
66
+    function loadBox($max=5)
67
+    {
68
+        global $conf, $user, $langs, $db;
69 69
 
70
-		$this->max=$max;
70
+        $this->max=$max;
71 71
 
72
-		$refreshaction='refresh_'.$this->boxcode;
72
+        $refreshaction='refresh_'.$this->boxcode;
73 73
 
74
-		//include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
75
-		//$commandestatic=new Commande($db);
74
+        //include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
75
+        //$commandestatic=new Commande($db);
76 76
 
77
-		$text = $langs->trans("BoxCustomersOrdersPerMonth",$max);
78
-		$this->info_box_head = array(
79
-				'text' => $text,
80
-				'limit'=> dol_strlen($text),
81
-				'graph'=> 1,
82
-				'sublink'=>'',
83
-				'subtext'=>$langs->trans("Filter"),
84
-				'subpicto'=>'filter.png',
85
-				'subclass'=>'linkobject boxfilter',
86
-				'target'=>'none'	// Set '' to get target="_blank"
87
-		);
77
+        $text = $langs->trans("BoxCustomersOrdersPerMonth",$max);
78
+        $this->info_box_head = array(
79
+                'text' => $text,
80
+                'limit'=> dol_strlen($text),
81
+                'graph'=> 1,
82
+                'sublink'=>'',
83
+                'subtext'=>$langs->trans("Filter"),
84
+                'subpicto'=>'filter.png',
85
+                'subclass'=>'linkobject boxfilter',
86
+                'target'=>'none'	// Set '' to get target="_blank"
87
+        );
88 88
 
89
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
90
-		$prefix='';
91
-		$socid=0;
92
-		if ($user->societe_id) $socid=$user->societe_id;
93
-		if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
89
+        $dir=''; 	// We don't need a path because image file will not be saved into disk
90
+        $prefix='';
91
+        $socid=0;
92
+        if ($user->societe_id) $socid=$user->societe_id;
93
+        if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
94 94
 
95
-		if ($user->rights->commande->lire)
96
-		{
97
-		    $langs->load("orders");
95
+        if ($user->rights->commande->lire)
96
+        {
97
+            $langs->load("orders");
98 98
 
99
-		    $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
99
+            $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
+            $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
+            $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
102 102
 
103
-			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104
-			include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
105
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
106
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
107
-			{
108
-				$endyear=GETPOST($param_year,'int');
109
-				$shownb=GETPOST($param_shownb,'alpha');
110
-				$showtot=GETPOST($param_showtot,'alpha');
111
-			}
112
-			else
113
-			{
114
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115
-				$endyear=$tmparray['year'];
116
-				$shownb=$tmparray['shownb'];
117
-				$showtot=$tmparray['showtot'];
118
-			}
119
-			if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
120
-			$nowarray=dol_getdate(dol_now(),true);
121
-			if (empty($endyear)) $endyear=$nowarray['year'];
122
-			$startyear=$endyear-1;
123
-			$mode='customer';
124
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
125
-			$HEIGHT='192';
103
+            include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104
+            include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
105
+            $autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
106
+            if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
107
+            {
108
+                $endyear=GETPOST($param_year,'int');
109
+                $shownb=GETPOST($param_shownb,'alpha');
110
+                $showtot=GETPOST($param_showtot,'alpha');
111
+            }
112
+            else
113
+            {
114
+                $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115
+                $endyear=$tmparray['year'];
116
+                $shownb=$tmparray['shownb'];
117
+                $showtot=$tmparray['showtot'];
118
+            }
119
+            if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
120
+            $nowarray=dol_getdate(dol_now(),true);
121
+            if (empty($endyear)) $endyear=$nowarray['year'];
122
+            $startyear=$endyear-1;
123
+            $mode='customer';
124
+            $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
125
+            $HEIGHT='192';
126 126
 
127
-			$stats = new CommandeStats($this->db, $socid, $mode, 0);
127
+            $stats = new CommandeStats($this->db, $socid, $mode, 0);
128 128
 
129
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
130
-			if ($shownb)
131
-			{
132
-				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
129
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
130
+            if ($shownb)
131
+            {
132
+                $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
133 133
 
134
-				$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
135
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
136
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersnbinyear-'.$endyear.'.png';
134
+                $filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
135
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
136
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersnbinyear-'.$endyear.'.png';
137 137
 
138
-				$px1 = new DolGraph();
139
-				$mesg = $px1->isGraphKo();
140
-				if (! $mesg)
141
-				{
142
-					$px1->SetData($data1);
143
-					unset($data1);
144
-					$px1->SetPrecisionY(0);
145
-					$i=$startyear;$legend=array();
146
-					while ($i <= $endyear)
147
-					{
148
-						$legend[]=$i;
149
-						$i++;
150
-					}
151
-					$px1->SetLegend($legend);
152
-					$px1->SetMaxValue($px1->GetCeilMaxValue());
153
-					$px1->SetWidth($WIDTH);
154
-					$px1->SetHeight($HEIGHT);
155
-					$px1->SetYLabel($langs->trans("NumberOfOrders"));
156
-					$px1->SetShading(3);
157
-					$px1->SetHorizTickIncrement(1);
158
-					$px1->SetPrecisionY(0);
159
-					$px1->SetCssPrefix("cssboxes");
160
-					$px1->mode='depth';
161
-					$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
138
+                $px1 = new DolGraph();
139
+                $mesg = $px1->isGraphKo();
140
+                if (! $mesg)
141
+                {
142
+                    $px1->SetData($data1);
143
+                    unset($data1);
144
+                    $px1->SetPrecisionY(0);
145
+                    $i=$startyear;$legend=array();
146
+                    while ($i <= $endyear)
147
+                    {
148
+                        $legend[]=$i;
149
+                        $i++;
150
+                    }
151
+                    $px1->SetLegend($legend);
152
+                    $px1->SetMaxValue($px1->GetCeilMaxValue());
153
+                    $px1->SetWidth($WIDTH);
154
+                    $px1->SetHeight($HEIGHT);
155
+                    $px1->SetYLabel($langs->trans("NumberOfOrders"));
156
+                    $px1->SetShading(3);
157
+                    $px1->SetHorizTickIncrement(1);
158
+                    $px1->SetPrecisionY(0);
159
+                    $px1->SetCssPrefix("cssboxes");
160
+                    $px1->mode='depth';
161
+                    $px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
162 162
 
163
-					$px1->draw($filenamenb,$fileurlnb);
164
-				}
165
-			}
163
+                    $px1->draw($filenamenb,$fileurlnb);
164
+                }
165
+            }
166 166
 
167
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
168
-			if ($showtot)
169
-			{
170
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
167
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
168
+            if ($showtot)
169
+            {
170
+                $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
171 171
 
172
-				$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
173
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
174
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersamountinyear-'.$endyear.'.png';
172
+                $filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
173
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
174
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersamountinyear-'.$endyear.'.png';
175 175
 
176
-				$px2 = new DolGraph();
177
-				$mesg = $px2->isGraphKo();
178
-				if (! $mesg)
179
-				{
180
-					$px2->SetData($data2);
181
-					unset($data2);
182
-					$px2->SetPrecisionY(0);
183
-					$i=$startyear;$legend=array();
184
-					while ($i <= $endyear)
185
-					{
186
-						$legend[]=$i;
187
-						$i++;
188
-					}
189
-					$px2->SetLegend($legend);
190
-					$px2->SetMaxValue($px2->GetCeilMaxValue());
191
-					$px2->SetWidth($WIDTH);
192
-					$px2->SetHeight($HEIGHT);
193
-					$px2->SetYLabel($langs->trans("AmountOfOrdersHT"));
194
-					$px2->SetShading(3);
195
-					$px2->SetHorizTickIncrement(1);
196
-					$px2->SetPrecisionY(0);
197
-					$px2->SetCssPrefix("cssboxes");
198
-					$px2->mode='depth';
199
-					$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
176
+                $px2 = new DolGraph();
177
+                $mesg = $px2->isGraphKo();
178
+                if (! $mesg)
179
+                {
180
+                    $px2->SetData($data2);
181
+                    unset($data2);
182
+                    $px2->SetPrecisionY(0);
183
+                    $i=$startyear;$legend=array();
184
+                    while ($i <= $endyear)
185
+                    {
186
+                        $legend[]=$i;
187
+                        $i++;
188
+                    }
189
+                    $px2->SetLegend($legend);
190
+                    $px2->SetMaxValue($px2->GetCeilMaxValue());
191
+                    $px2->SetWidth($WIDTH);
192
+                    $px2->SetHeight($HEIGHT);
193
+                    $px2->SetYLabel($langs->trans("AmountOfOrdersHT"));
194
+                    $px2->SetShading(3);
195
+                    $px2->SetHorizTickIncrement(1);
196
+                    $px2->SetPrecisionY(0);
197
+                    $px2->SetCssPrefix("cssboxes");
198
+                    $px2->mode='depth';
199
+                    $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
200 200
 
201
-					$px2->draw($filenamenb,$fileurlnb);
202
-				}
203
-			}
201
+                    $px2->draw($filenamenb,$fileurlnb);
202
+                }
203
+            }
204 204
 
205
-			if (empty($conf->use_javascript_ajax))
206
-			{
207
-				$langs->load("errors");
208
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
209
-			}
205
+            if (empty($conf->use_javascript_ajax))
206
+            {
207
+                $langs->load("errors");
208
+                $mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
209
+            }
210 210
 
211
-			if (! $mesg)
212
-			{
213
-				$stringtoshow='';
214
-				$stringtoshow.='<script type="text/javascript" language="javascript">
211
+            if (! $mesg)
212
+            {
213
+                $stringtoshow='';
214
+                $stringtoshow.='<script type="text/javascript" language="javascript">
215 215
 					jQuery(document).ready(function() {
216 216
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
217 217
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
218 218
 						});
219 219
 					});
220 220
 					</script>';
221
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
222
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
223
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
224
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
225
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
226
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
227
-				$stringtoshow.=' &nbsp; ';
228
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
229
-				$stringtoshow.='<br>';
230
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
231
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
232
-				$stringtoshow.='</form>';
233
-				$stringtoshow.='</div>';
234
-				if ($shownb && $showtot)
235
-				{
236
-					$stringtoshow.='<div class="fichecenter">';
237
-					$stringtoshow.='<div class="fichehalfleft">';
238
-				}
239
-				if ($shownb) $stringtoshow.=$px1->show();
240
-				if ($shownb && $showtot)
241
-				{
242
-					$stringtoshow.='</div>';
243
-					$stringtoshow.='<div class="fichehalfright">';
244
-				}
245
-				if ($showtot) $stringtoshow.=$px2->show();
246
-				if ($shownb && $showtot)
247
-				{
248
-					$stringtoshow.='</div>';
249
-					$stringtoshow.='</div>';
250
-				}
251
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
252
-			}
253
-			else
254
-			{
255
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
256
-    	        										'maxlength'=>500,
257
-	            										'text' => $mesg);
258
-			}
259
-		}
260
-		else {
261
-			$this->info_box_contents[0][0] = array(
262
-			    'td' => 'align="left" class="nohover opacitymedium"',
221
+                $stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
222
+                $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
223
+                $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
224
+                $stringtoshow.='<input type="hidden" name="page_y" value="">';
225
+                $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
226
+                $stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
227
+                $stringtoshow.=' &nbsp; ';
228
+                $stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
229
+                $stringtoshow.='<br>';
230
+                $stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
231
+                $stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
232
+                $stringtoshow.='</form>';
233
+                $stringtoshow.='</div>';
234
+                if ($shownb && $showtot)
235
+                {
236
+                    $stringtoshow.='<div class="fichecenter">';
237
+                    $stringtoshow.='<div class="fichehalfleft">';
238
+                }
239
+                if ($shownb) $stringtoshow.=$px1->show();
240
+                if ($shownb && $showtot)
241
+                {
242
+                    $stringtoshow.='</div>';
243
+                    $stringtoshow.='<div class="fichehalfright">';
244
+                }
245
+                if ($showtot) $stringtoshow.=$px2->show();
246
+                if ($shownb && $showtot)
247
+                {
248
+                    $stringtoshow.='</div>';
249
+                    $stringtoshow.='</div>';
250
+                }
251
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
252
+            }
253
+            else
254
+            {
255
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
256
+                                                        'maxlength'=>500,
257
+                                                        'text' => $mesg);
258
+            }
259
+        }
260
+        else {
261
+            $this->info_box_contents[0][0] = array(
262
+                'td' => 'align="left" class="nohover opacitymedium"',
263 263
                 'text' => $langs->trans("ReadPermissionNotAllowed")
264
-			);
265
-		}
266
-	}
264
+            );
265
+        }
266
+    }
267 267
 
268
-	/**
269
-	 *	Method to show box
270
-	 *
271
-	 *	@param	array	$head       Array with properties of box title
272
-	 *	@param  array	$contents   Array with properties of box lines
273
-	 *  @param	int		$nooutput	No print, only return string
274
-	 *	@return	string
275
-	 */
268
+    /**
269
+     *	Method to show box
270
+     *
271
+     *	@param	array	$head       Array with properties of box title
272
+     *	@param  array	$contents   Array with properties of box lines
273
+     *  @param	int		$nooutput	No print, only return string
274
+     *	@return	string
275
+     */
276 276
     function showBox($head = null, $contents = null, $nooutput=0)
277 277
     {
278
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
279
-	}
278
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
279
+    }
280 280
 }
281 281
 
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class box_graph_orders_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="orderspermonth";
32
-	var $boximg="object_order";
33
-	var $boxlabel="BoxCustomersOrdersPerMonth";
31
+	var $boxcode = "orderspermonth";
32
+	var $boximg = "object_order";
33
+	var $boxlabel = "BoxCustomersOrdersPerMonth";
34 34
 	var $depends = array("commande");
35 35
 
36 36
 	/**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	 * 	@param	DoliDB	$db			Database handler
49 49
 	 *  @param	string	$param		More parameters
50 50
 	 */
51
-	function __construct($db,$param)
51
+	function __construct($db, $param)
52 52
 	{
53 53
 		global $user;
54 54
 
55
-		$this->db=$db;
55
+		$this->db = $db;
56 56
 
57
-		$this->hidden = ! ($user->rights->commande->lire);
57
+		$this->hidden = !($user->rights->commande->lire);
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
 	 *  @param	int		$max        Maximum number of records to load
64 64
      *  @return	void
65 65
 	 */
66
-	function loadBox($max=5)
66
+	function loadBox($max = 5)
67 67
 	{
68 68
 		global $conf, $user, $langs, $db;
69 69
 
70
-		$this->max=$max;
70
+		$this->max = $max;
71 71
 
72
-		$refreshaction='refresh_'.$this->boxcode;
72
+		$refreshaction = 'refresh_'.$this->boxcode;
73 73
 
74 74
 		//include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
75 75
 		//$commandestatic=new Commande($db);
76 76
 
77
-		$text = $langs->trans("BoxCustomersOrdersPerMonth",$max);
77
+		$text = $langs->trans("BoxCustomersOrdersPerMonth", $max);
78 78
 		$this->info_box_head = array(
79 79
 				'text' => $text,
80 80
 				'limit'=> dol_strlen($text),
@@ -86,50 +86,50 @@  discard block
 block discarded – undo
86 86
 				'target'=>'none'	// Set '' to get target="_blank"
87 87
 		);
88 88
 
89
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
90
-		$prefix='';
91
-		$socid=0;
92
-		if ($user->societe_id) $socid=$user->societe_id;
93
-		if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
89
+		$dir = ''; // We don't need a path because image file will not be saved into disk
90
+		$prefix = '';
91
+		$socid = 0;
92
+		if ($user->societe_id) $socid = $user->societe_id;
93
+		if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
94 94
 
95 95
 		if ($user->rights->commande->lire)
96 96
 		{
97 97
 		    $langs->load("orders");
98 98
 
99
-		    $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
99
+		    $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
+			$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
+			$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
102 102
 
103 103
 			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104 104
 			include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
105
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
106
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
105
+			$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
106
+			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
107 107
 			{
108
-				$endyear=GETPOST($param_year,'int');
109
-				$shownb=GETPOST($param_shownb,'alpha');
110
-				$showtot=GETPOST($param_showtot,'alpha');
108
+				$endyear = GETPOST($param_year, 'int');
109
+				$shownb = GETPOST($param_shownb, 'alpha');
110
+				$showtot = GETPOST($param_showtot, 'alpha');
111 111
 			}
112 112
 			else
113 113
 			{
114
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115
-				$endyear=$tmparray['year'];
116
-				$shownb=$tmparray['shownb'];
117
-				$showtot=$tmparray['showtot'];
114
+				$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
115
+				$endyear = $tmparray['year'];
116
+				$shownb = $tmparray['shownb'];
117
+				$showtot = $tmparray['showtot'];
118 118
 			}
119
-			if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
120
-			$nowarray=dol_getdate(dol_now(),true);
121
-			if (empty($endyear)) $endyear=$nowarray['year'];
122
-			$startyear=$endyear-1;
123
-			$mode='customer';
124
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
125
-			$HEIGHT='192';
119
+			if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
120
+			$nowarray = dol_getdate(dol_now(), true);
121
+			if (empty($endyear)) $endyear = $nowarray['year'];
122
+			$startyear = $endyear - 1;
123
+			$mode = 'customer';
124
+			$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
125
+			$HEIGHT = '192';
126 126
 
127 127
 			$stats = new CommandeStats($this->db, $socid, $mode, 0);
128 128
 
129 129
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
130 130
 			if ($shownb)
131 131
 			{
132
-				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
132
+				$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
133 133
 
134 134
 				$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
135 135
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 
138 138
 				$px1 = new DolGraph();
139 139
 				$mesg = $px1->isGraphKo();
140
-				if (! $mesg)
140
+				if (!$mesg)
141 141
 				{
142 142
 					$px1->SetData($data1);
143 143
 					unset($data1);
144 144
 					$px1->SetPrecisionY(0);
145
-					$i=$startyear;$legend=array();
145
+					$i = $startyear; $legend = array();
146 146
 					while ($i <= $endyear)
147 147
 					{
148
-						$legend[]=$i;
148
+						$legend[] = $i;
149 149
 						$i++;
150 150
 					}
151 151
 					$px1->SetLegend($legend);
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
 					$px1->SetHorizTickIncrement(1);
158 158
 					$px1->SetPrecisionY(0);
159 159
 					$px1->SetCssPrefix("cssboxes");
160
-					$px1->mode='depth';
160
+					$px1->mode = 'depth';
161 161
 					$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
162 162
 
163
-					$px1->draw($filenamenb,$fileurlnb);
163
+					$px1->draw($filenamenb, $fileurlnb);
164 164
 				}
165 165
 			}
166 166
 
167 167
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
168 168
 			if ($showtot)
169 169
 			{
170
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
170
+				$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
171 171
 
172 172
 				$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
173 173
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
 
176 176
 				$px2 = new DolGraph();
177 177
 				$mesg = $px2->isGraphKo();
178
-				if (! $mesg)
178
+				if (!$mesg)
179 179
 				{
180 180
 					$px2->SetData($data2);
181 181
 					unset($data2);
182 182
 					$px2->SetPrecisionY(0);
183
-					$i=$startyear;$legend=array();
183
+					$i = $startyear; $legend = array();
184 184
 					while ($i <= $endyear)
185 185
 					{
186
-						$legend[]=$i;
186
+						$legend[] = $i;
187 187
 						$i++;
188 188
 					}
189 189
 					$px2->SetLegend($legend);
@@ -195,64 +195,64 @@  discard block
 block discarded – undo
195 195
 					$px2->SetHorizTickIncrement(1);
196 196
 					$px2->SetPrecisionY(0);
197 197
 					$px2->SetCssPrefix("cssboxes");
198
-					$px2->mode='depth';
198
+					$px2->mode = 'depth';
199 199
 					$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
200 200
 
201
-					$px2->draw($filenamenb,$fileurlnb);
201
+					$px2->draw($filenamenb, $fileurlnb);
202 202
 				}
203 203
 			}
204 204
 
205 205
 			if (empty($conf->use_javascript_ajax))
206 206
 			{
207 207
 				$langs->load("errors");
208
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
208
+				$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
209 209
 			}
210 210
 
211
-			if (! $mesg)
211
+			if (!$mesg)
212 212
 			{
213
-				$stringtoshow='';
214
-				$stringtoshow.='<script type="text/javascript" language="javascript">
213
+				$stringtoshow = '';
214
+				$stringtoshow .= '<script type="text/javascript" language="javascript">
215 215
 					jQuery(document).ready(function() {
216 216
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
217 217
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
218 218
 						});
219 219
 					});
220 220
 					</script>';
221
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
222
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
223
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
224
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
225
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
226
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
227
-				$stringtoshow.=' &nbsp; ';
228
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
229
-				$stringtoshow.='<br>';
230
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
231
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
232
-				$stringtoshow.='</form>';
233
-				$stringtoshow.='</div>';
221
+				$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
222
+				$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
223
+				$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
224
+				$stringtoshow .= '<input type="hidden" name="page_y" value="">';
225
+				$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
226
+				$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfOrdersByMonth");
227
+				$stringtoshow .= ' &nbsp; ';
228
+				$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfOrdersByMonthHT");
229
+				$stringtoshow .= '<br>';
230
+				$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
231
+				$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
232
+				$stringtoshow .= '</form>';
233
+				$stringtoshow .= '</div>';
234 234
 				if ($shownb && $showtot)
235 235
 				{
236
-					$stringtoshow.='<div class="fichecenter">';
237
-					$stringtoshow.='<div class="fichehalfleft">';
236
+					$stringtoshow .= '<div class="fichecenter">';
237
+					$stringtoshow .= '<div class="fichehalfleft">';
238 238
 				}
239
-				if ($shownb) $stringtoshow.=$px1->show();
239
+				if ($shownb) $stringtoshow .= $px1->show();
240 240
 				if ($shownb && $showtot)
241 241
 				{
242
-					$stringtoshow.='</div>';
243
-					$stringtoshow.='<div class="fichehalfright">';
242
+					$stringtoshow .= '</div>';
243
+					$stringtoshow .= '<div class="fichehalfright">';
244 244
 				}
245
-				if ($showtot) $stringtoshow.=$px2->show();
245
+				if ($showtot) $stringtoshow .= $px2->show();
246 246
 				if ($shownb && $showtot)
247 247
 				{
248
-					$stringtoshow.='</div>';
249
-					$stringtoshow.='</div>';
248
+					$stringtoshow .= '</div>';
249
+					$stringtoshow .= '</div>';
250 250
 				}
251
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
251
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"', 'textnoformat'=>$stringtoshow);
252 252
 			}
253 253
 			else
254 254
 			{
255
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
255
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"',
256 256
     	        										'maxlength'=>500,
257 257
 	            										'text' => $mesg);
258 258
 			}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 *  @param	int		$nooutput	No print, only return string
274 274
 	 *	@return	string
275 275
 	 */
276
-    function showBox($head = null, $contents = null, $nooutput=0)
276
+    function showBox($head = null, $contents = null, $nooutput = 0)
277 277
     {
278 278
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
279 279
 	}
Please login to merge, or discard this patch.
Braces   +31 added lines, -15 removed lines patch added patch discarded remove patch
@@ -89,8 +89,13 @@  discard block
 block discarded – undo
89 89
 		$dir=''; 	// We don't need a path because image file will not be saved into disk
90 90
 		$prefix='';
91 91
 		$socid=0;
92
-		if ($user->societe_id) $socid=$user->societe_id;
93
-		if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
92
+		if ($user->societe_id) {
93
+		    $socid=$user->societe_id;
94
+		}
95
+		if (! $user->rights->societe->client->voir || $socid) {
96
+		    $prefix.='private-'.$user->id.'-';
97
+		}
98
+		// If user has no permission to see all, output dir is specific to user
94 99
 
95 100
 		if ($user->rights->commande->lire)
96 101
 		{
@@ -108,8 +113,7 @@  discard block
 block discarded – undo
108 113
 				$endyear=GETPOST($param_year,'int');
109 114
 				$shownb=GETPOST($param_shownb,'alpha');
110 115
 				$showtot=GETPOST($param_showtot,'alpha');
111
-			}
112
-			else
116
+			} else
113 117
 			{
114 118
 				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115 119
 				$endyear=$tmparray['year'];
@@ -118,7 +122,9 @@  discard block
 block discarded – undo
118 122
 			}
119 123
 			if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
120 124
 			$nowarray=dol_getdate(dol_now(),true);
121
-			if (empty($endyear)) $endyear=$nowarray['year'];
125
+			if (empty($endyear)) {
126
+			    $endyear=$nowarray['year'];
127
+			}
122 128
 			$startyear=$endyear-1;
123 129
 			$mode='customer';
124 130
 			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
@@ -132,8 +138,12 @@  discard block
 block discarded – undo
132 138
 				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
133 139
 
134 140
 				$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
135
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
136
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersnbinyear-'.$endyear.'.png';
141
+				if ($mode == 'customer') {
142
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
143
+				}
144
+				if ($mode == 'supplier') {
145
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersnbinyear-'.$endyear.'.png';
146
+				}
137 147
 
138 148
 				$px1 = new DolGraph();
139 149
 				$mesg = $px1->isGraphKo();
@@ -170,8 +180,12 @@  discard block
 block discarded – undo
170 180
 				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
171 181
 
172 182
 				$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
173
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
174
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersamountinyear-'.$endyear.'.png';
183
+				if ($mode == 'customer') {
184
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
185
+				}
186
+				if ($mode == 'supplier') {
187
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersamountinyear-'.$endyear.'.png';
188
+				}
175 189
 
176 190
 				$px2 = new DolGraph();
177 191
 				$mesg = $px2->isGraphKo();
@@ -236,28 +250,30 @@  discard block
 block discarded – undo
236 250
 					$stringtoshow.='<div class="fichecenter">';
237 251
 					$stringtoshow.='<div class="fichehalfleft">';
238 252
 				}
239
-				if ($shownb) $stringtoshow.=$px1->show();
253
+				if ($shownb) {
254
+				    $stringtoshow.=$px1->show();
255
+				}
240 256
 				if ($shownb && $showtot)
241 257
 				{
242 258
 					$stringtoshow.='</div>';
243 259
 					$stringtoshow.='<div class="fichehalfright">';
244 260
 				}
245
-				if ($showtot) $stringtoshow.=$px2->show();
261
+				if ($showtot) {
262
+				    $stringtoshow.=$px2->show();
263
+				}
246 264
 				if ($shownb && $showtot)
247 265
 				{
248 266
 					$stringtoshow.='</div>';
249 267
 					$stringtoshow.='</div>';
250 268
 				}
251 269
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
252
-			}
253
-			else
270
+			} else
254 271
 			{
255 272
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
256 273
     	        										'maxlength'=>500,
257 274
 	            										'text' => $mesg);
258 275
 			}
259
-		}
260
-		else {
276
+		} else {
261 277
 			$this->info_box_contents[0][0] = array(
262 278
 			    'td' => 'align="left" class="nohover opacitymedium"',
263 279
                 'text' => $langs->trans("ReadPermissionNotAllowed")
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_bookmarks.php 3 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -28,79 +28,79 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class box_bookmarks extends ModeleBoxes
30 30
 {
31
-	var $boxcode="bookmarks";
32
-	var $boximg="object_bookmark";
33
-	var $boxlabel="BoxMyLastBookmarks";
34
-	var $depends = array("bookmark");
31
+    var $boxcode="bookmarks";
32
+    var $boximg="object_bookmark";
33
+    var $boxlabel="BoxMyLastBookmarks";
34
+    var $depends = array("bookmark");
35 35
 
36
-	/**
36
+    /**
37 37
      * @var DoliDB Database handler.
38 38
      */
39 39
     public $db;
40 40
     
41
-	var $param;
41
+    var $param;
42 42
 
43
-	var $info_box_head = array();
44
-	var $info_box_contents = array();
43
+    var $info_box_head = array();
44
+    var $info_box_contents = array();
45 45
 
46 46
 
47
-	/**
48
-	 *  Constructor
49
-	 *
50
-	 *  @param  DoliDB  $db         Database handler
51
-	 *  @param  string  $param      More parameters
52
-	 */
53
-	function __construct($db,$param)
54
-	{
55
-	    global $user;
47
+    /**
48
+     *  Constructor
49
+     *
50
+     *  @param  DoliDB  $db         Database handler
51
+     *  @param  string  $param      More parameters
52
+     */
53
+    function __construct($db,$param)
54
+    {
55
+        global $user;
56 56
 
57
-	    $this->db=$db;
57
+        $this->db=$db;
58 58
 
59
-	    $this->hidden=! ($user->rights->bookmark->lire);
60
-	}
59
+        $this->hidden=! ($user->rights->bookmark->lire);
60
+    }
61 61
 
62
-	/**
62
+    /**
63 63
      *  Load data for box to show them later
64 64
      *
65 65
      *  @param	int		$max        Maximum number of records to load
66 66
      *  @return	void
67
-	 */
68
-	function loadBox($max=5)
69
-	{
70
-		global $user, $langs, $db, $conf;
71
-		$langs->load("boxes");
67
+     */
68
+    function loadBox($max=5)
69
+    {
70
+        global $user, $langs, $db, $conf;
71
+        $langs->load("boxes");
72 72
 
73
-		$this->max=$max;
73
+        $this->max=$max;
74 74
 
75
-		$this->info_box_head = array(
75
+        $this->info_box_head = array(
76 76
             'text' => $langs->trans("BoxMyLastBookmarks",$max),
77 77
             'sublink' => DOL_URL_ROOT.'/bookmarks/list.php',
78 78
         );
79 79
         if ($user->rights->bookmark->creer) {
80
-			$this->info_box_head['subpicto']='object_bookmark';
81
-			$this->info_box_head['subtext']=$langs->trans("BookmarksManagement");
82
-		}
83
-		else
84
-		{
85
-			$this->info_box_head['subpicto']='object_bookmark';
86
-			$this->info_box_head['subtext']=$langs->trans("ListOfBookmark");
87
-		}
88
-
89
-		if ($user->rights->bookmark->lire)
90
-		{
91
-			$sql = "SELECT b.title, b.url, b.target, b.favicon";
92
-			$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b";
93
-			$sql.= " WHERE fk_user = ".$user->id;
80
+            $this->info_box_head['subpicto']='object_bookmark';
81
+            $this->info_box_head['subtext']=$langs->trans("BookmarksManagement");
82
+        }
83
+        else
84
+        {
85
+            $this->info_box_head['subpicto']='object_bookmark';
86
+            $this->info_box_head['subtext']=$langs->trans("ListOfBookmark");
87
+        }
88
+
89
+        if ($user->rights->bookmark->lire)
90
+        {
91
+            $sql = "SELECT b.title, b.url, b.target, b.favicon";
92
+            $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b";
93
+            $sql.= " WHERE fk_user = ".$user->id;
94 94
             $sql.= " AND b.entity = ".$conf->entity;
95
-			$sql.= $db->order("position","ASC");
96
-			$sql.= $db->plimit($max, 0);
95
+            $sql.= $db->order("position","ASC");
96
+            $sql.= $db->plimit($max, 0);
97 97
 
98
-			$result = $db->query($sql);
99
-			if ($result)
100
-			{
101
-				$num = $db->num_rows($result);
98
+            $result = $db->query($sql);
99
+            if ($result)
100
+            {
101
+                $num = $db->num_rows($result);
102 102
 
103
-				$line = 0;
103
+                $line = 0;
104 104
 
105 105
                 while ($line < $num) {
106 106
                     $objp = $db->fetch_object($result);
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
         }
150 150
     }
151 151
 
152
-	/**
153
-	 *	Method to show box
154
-	 *
155
-	 *	@param	array	$head       Array with properties of box title
156
-	 *	@param  array	$contents   Array with properties of box lines
157
-	 *  @param	int		$nooutput	No print, only return string
158
-	 *	@return	string
159
-	 */
152
+    /**
153
+     *	Method to show box
154
+     *
155
+     *	@param	array	$head       Array with properties of box title
156
+     *	@param  array	$contents   Array with properties of box lines
157
+     *  @param	int		$nooutput	No print, only return string
158
+     *	@return	string
159
+     */
160 160
     function showBox($head = null, $contents = null, $nooutput=0)
161 161
     {
162
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
163
-	}
162
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
163
+    }
164 164
 }
165 165
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class box_bookmarks extends ModeleBoxes
30 30
 {
31
-	var $boxcode="bookmarks";
32
-	var $boximg="object_bookmark";
33
-	var $boxlabel="BoxMyLastBookmarks";
31
+	var $boxcode = "bookmarks";
32
+	var $boximg = "object_bookmark";
33
+	var $boxlabel = "BoxMyLastBookmarks";
34 34
 	var $depends = array("bookmark");
35 35
 
36 36
 	/**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	 *  @param  DoliDB  $db         Database handler
51 51
 	 *  @param  string  $param      More parameters
52 52
 	 */
53
-	function __construct($db,$param)
53
+	function __construct($db, $param)
54 54
 	{
55 55
 	    global $user;
56 56
 
57
-	    $this->db=$db;
57
+	    $this->db = $db;
58 58
 
59
-	    $this->hidden=! ($user->rights->bookmark->lire);
59
+	    $this->hidden = !($user->rights->bookmark->lire);
60 60
 	}
61 61
 
62 62
 	/**
@@ -65,35 +65,35 @@  discard block
 block discarded – undo
65 65
      *  @param	int		$max        Maximum number of records to load
66 66
      *  @return	void
67 67
 	 */
68
-	function loadBox($max=5)
68
+	function loadBox($max = 5)
69 69
 	{
70 70
 		global $user, $langs, $db, $conf;
71 71
 		$langs->load("boxes");
72 72
 
73
-		$this->max=$max;
73
+		$this->max = $max;
74 74
 
75 75
 		$this->info_box_head = array(
76
-            'text' => $langs->trans("BoxMyLastBookmarks",$max),
76
+            'text' => $langs->trans("BoxMyLastBookmarks", $max),
77 77
             'sublink' => DOL_URL_ROOT.'/bookmarks/list.php',
78 78
         );
79 79
         if ($user->rights->bookmark->creer) {
80
-			$this->info_box_head['subpicto']='object_bookmark';
81
-			$this->info_box_head['subtext']=$langs->trans("BookmarksManagement");
80
+			$this->info_box_head['subpicto'] = 'object_bookmark';
81
+			$this->info_box_head['subtext'] = $langs->trans("BookmarksManagement");
82 82
 		}
83 83
 		else
84 84
 		{
85
-			$this->info_box_head['subpicto']='object_bookmark';
86
-			$this->info_box_head['subtext']=$langs->trans("ListOfBookmark");
85
+			$this->info_box_head['subpicto'] = 'object_bookmark';
86
+			$this->info_box_head['subtext'] = $langs->trans("ListOfBookmark");
87 87
 		}
88 88
 
89 89
 		if ($user->rights->bookmark->lire)
90 90
 		{
91 91
 			$sql = "SELECT b.title, b.url, b.target, b.favicon";
92
-			$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b";
93
-			$sql.= " WHERE fk_user = ".$user->id;
94
-            $sql.= " AND b.entity = ".$conf->entity;
95
-			$sql.= $db->order("position","ASC");
96
-			$sql.= $db->plimit($max, 0);
92
+			$sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b";
93
+			$sql .= " WHERE fk_user = ".$user->id;
94
+            $sql .= " AND b.entity = ".$conf->entity;
95
+			$sql .= $db->order("position", "ASC");
96
+			$sql .= $db->plimit($max, 0);
97 97
 
98 98
 			$result = $db->query($sql);
99 99
 			if ($result)
@@ -110,22 +110,22 @@  discard block
 block discarded – undo
110 110
                         'logo' => $this->boximg,
111 111
                         'url' => $objp->url,
112 112
                         'tooltip' => $objp->title,
113
-                        'target' => $objp->target?'newtab':'',
113
+                        'target' => $objp->target ? 'newtab' : '',
114 114
                     );
115 115
                     $this->info_box_contents[$line][1] = array(
116 116
                         'td' => '',
117 117
                         'text' => $objp->title,
118 118
                         'url' => $objp->url,
119 119
                         'tooltip' => $objp->title,
120
-                        'target' => $objp->target?'newtab':'',
120
+                        'target' => $objp->target ? 'newtab' : '',
121 121
                     );
122 122
 
123 123
                     $line++;
124 124
                 }
125 125
 
126
-                if ($num==0) {
127
-                    $mytxt=$langs->trans("NoRecordedBookmarks");
128
-                    if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd");
126
+                if ($num == 0) {
127
+                    $mytxt = $langs->trans("NoRecordedBookmarks");
128
+                    if ($user->rights->bookmark->creer) $mytxt .= ' '.$langs->trans("ClickToAdd");
129 129
                     $this->info_box_contents[$line][0] = array(
130 130
                         'td' => 'align="center" colspan="2"',
131 131
                         'tooltip' => $mytxt,
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 *  @param	int		$nooutput	No print, only return string
158 158
 	 *	@return	string
159 159
 	 */
160
-    function showBox($head = null, $contents = null, $nooutput=0)
160
+    function showBox($head = null, $contents = null, $nooutput = 0)
161 161
     {
162 162
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
163 163
 	}
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
         if ($user->rights->bookmark->creer) {
80 80
 			$this->info_box_head['subpicto']='object_bookmark';
81 81
 			$this->info_box_head['subtext']=$langs->trans("BookmarksManagement");
82
-		}
83
-		else
82
+		} else
84 83
 		{
85 84
 			$this->info_box_head['subpicto']='object_bookmark';
86 85
 			$this->info_box_head['subtext']=$langs->trans("ListOfBookmark");
@@ -125,7 +124,9 @@  discard block
 block discarded – undo
125 124
 
126 125
                 if ($num==0) {
127 126
                     $mytxt=$langs->trans("NoRecordedBookmarks");
128
-                    if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd");
127
+                    if ($user->rights->bookmark->creer) {
128
+                        $mytxt.=' '.$langs->trans("ClickToAdd");
129
+                    }
129 130
                     $this->info_box_contents[$line][0] = array(
130 131
                         'td' => 'align="center" colspan="2"',
131 132
                         'tooltip' => $mytxt,
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_propales.php 3 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -64,54 +64,54 @@  discard block
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-	 *  Load data into info_box_contents array to show array later.
68
-	 *
69
-	 *  @param	int		$max        Maximum number of records to load
67
+     *  Load data into info_box_contents array to show array later.
68
+     *
69
+     *  @param	int		$max        Maximum number of records to load
70 70
      *  @return	void
71 71
      */
72 72
     function loadBox($max=5)
73 73
     {
74
-    	global $user, $langs, $db, $conf;
74
+        global $user, $langs, $db, $conf;
75 75
 
76
-    	$this->max=$max;
76
+        $this->max=$max;
77 77
 
78
-    	include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
78
+        include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
79 79
         include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
80
-    	$propalstatic=new Propal($db);
80
+        $propalstatic=new Propal($db);
81 81
         $societestatic = new Societe($db);
82 82
 
83 83
         $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max));
84 84
 
85
-    	if ($user->rights->propale->lire)
86
-    	{
87
-    		$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,";
88
-    		$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
89
-    		$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
90
-    		$sql.= ", ".MAIN_DB_PREFIX."propal as p";
91
-    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
-    		$sql.= " WHERE p.fk_soc = s.rowid";
93
-    		$sql.= " AND p.entity = ".$conf->entity;
94
-    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
95
-    		if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
85
+        if ($user->rights->propale->lire)
86
+        {
87
+            $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,";
88
+            $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
89
+            $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
90
+            $sql.= ", ".MAIN_DB_PREFIX."propal as p";
91
+            if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
+            $sql.= " WHERE p.fk_soc = s.rowid";
93
+            $sql.= " AND p.entity = ".$conf->entity;
94
+            if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
95
+            if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
96 96
             if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC ";
97 97
             else $sql.= " ORDER BY p.tms DESC, p.ref DESC ";
98
-    		$sql.= $db->plimit($max, 0);
98
+            $sql.= $db->plimit($max, 0);
99 99
 
100
-    		$result = $db->query($sql);
101
-    		if ($result)
102
-    		{
103
-    			$num = $db->num_rows($result);
104
-    			$now=dol_now();
100
+            $result = $db->query($sql);
101
+            if ($result)
102
+            {
103
+                $num = $db->num_rows($result);
104
+                $now=dol_now();
105 105
 
106
-    			$line = 0;
106
+                $line = 0;
107 107
 
108 108
                 while ($line < $num) {
109
-    				$objp = $db->fetch_object($result);
110
-    				$date=$db->jdate($objp->dp);
111
-    				$datec=$db->jdate($objp->datec);
112
-    				$datem=$db->jdate($objp->tms);
113
-    				$dateterm=$db->jdate($objp->fin_validite);
114
-    				$dateclose=$db->jdate($objp->date_cloture);
109
+                    $objp = $db->fetch_object($result);
110
+                    $date=$db->jdate($objp->dp);
111
+                    $datec=$db->jdate($objp->datec);
112
+                    $datem=$db->jdate($objp->tms);
113
+                    $dateterm=$db->jdate($objp->fin_validite);
114
+                    $dateclose=$db->jdate($objp->date_cloture);
115 115
                     $propalstatic->id = $objp->rowid;
116 116
                     $propalstatic->ref = $objp->ref;
117 117
                     $propalstatic->total_ht = $objp->total_ht;
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
                     $societestatic->code_client = $objp->code_client;
123 123
                     $societestatic->logo = $objp->logo;
124 124
 
125
-    				$late = '';
126
-    				if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
127
-    					$late = img_warning($langs->trans("Late"));
128
-    				}
125
+                    $late = '';
126
+                    if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
127
+                        $late = img_warning($langs->trans("Late"));
128
+                    }
129 129
 
130 130
                     $this->info_box_contents[$line][] = array(
131 131
                         'td' => '',
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
         }
181 181
     }
182 182
 
183
-	/**
184
-	 *	Method to show box
185
-	 *
186
-	 *	@param	array	$head       Array with properties of box title
187
-	 *	@param  array	$contents   Array with properties of box lines
188
-	 *  @param	int		$nooutput	No print, only return string
189
-	 *	@return	string
190
-	 */
183
+    /**
184
+     *	Method to show box
185
+     *
186
+     *	@param	array	$head       Array with properties of box title
187
+     *	@param  array	$contents   Array with properties of box lines
188
+     *  @param	int		$nooutput	No print, only return string
189
+     *	@return	string
190
+     */
191 191
     function showBox($head = null, $contents = null, $nooutput=0)
192 192
     {
193 193
         return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class box_propales extends ModeleBoxes
34 34
 {
35
-    var $boxcode="lastpropals";
36
-    var $boximg="object_propal";
37
-    var $boxlabel="BoxLastProposals";
38
-    var $depends = array("propal");	// conf->propal->enabled
35
+    var $boxcode = "lastpropals";
36
+    var $boximg = "object_propal";
37
+    var $boxlabel = "BoxLastProposals";
38
+    var $depends = array("propal"); // conf->propal->enabled
39 39
 
40 40
     /**
41 41
      * @var DoliDB Database handler.
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
      *  @param  DoliDB  $db         Database handler
55 55
      *  @param  string  $param      More parameters
56 56
      */
57
-    function __construct($db,$param)
57
+    function __construct($db, $param)
58 58
     {
59 59
         global $user;
60 60
 
61
-        $this->db=$db;
61
+        $this->db = $db;
62 62
 
63
-        $this->hidden=! ($user->rights->propale->lire);
63
+        $this->hidden = !($user->rights->propale->lire);
64 64
     }
65 65
 
66 66
     /**
@@ -69,49 +69,49 @@  discard block
 block discarded – undo
69 69
 	 *  @param	int		$max        Maximum number of records to load
70 70
      *  @return	void
71 71
      */
72
-    function loadBox($max=5)
72
+    function loadBox($max = 5)
73 73
     {
74 74
     	global $user, $langs, $db, $conf;
75 75
 
76
-    	$this->max=$max;
76
+    	$this->max = $max;
77 77
 
78 78
     	include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
79 79
         include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
80
-    	$propalstatic=new Propal($db);
80
+    	$propalstatic = new Propal($db);
81 81
         $societestatic = new Societe($db);
82 82
 
83
-        $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max));
83
+        $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."Propals", $max));
84 84
 
85 85
     	if ($user->rights->propale->lire)
86 86
     	{
87 87
     		$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,";
88
-    		$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
89
-    		$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
90
-    		$sql.= ", ".MAIN_DB_PREFIX."propal as p";
91
-    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
-    		$sql.= " WHERE p.fk_soc = s.rowid";
93
-    		$sql.= " AND p.entity = ".$conf->entity;
94
-    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
95
-    		if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
96
-            if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC ";
97
-            else $sql.= " ORDER BY p.tms DESC, p.ref DESC ";
98
-    		$sql.= $db->plimit($max, 0);
88
+    		$sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
89
+    		$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
90
+    		$sql .= ", ".MAIN_DB_PREFIX."propal as p";
91
+    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
+    		$sql .= " WHERE p.fk_soc = s.rowid";
93
+    		$sql .= " AND p.entity = ".$conf->entity;
94
+    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
95
+    		if ($user->societe_id) $sql .= " AND s.rowid = ".$user->societe_id;
96
+            if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC ";
97
+            else $sql .= " ORDER BY p.tms DESC, p.ref DESC ";
98
+    		$sql .= $db->plimit($max, 0);
99 99
 
100 100
     		$result = $db->query($sql);
101 101
     		if ($result)
102 102
     		{
103 103
     			$num = $db->num_rows($result);
104
-    			$now=dol_now();
104
+    			$now = dol_now();
105 105
 
106 106
     			$line = 0;
107 107
 
108 108
                 while ($line < $num) {
109 109
     				$objp = $db->fetch_object($result);
110
-    				$date=$db->jdate($objp->dp);
111
-    				$datec=$db->jdate($objp->datec);
112
-    				$datem=$db->jdate($objp->tms);
113
-    				$dateterm=$db->jdate($objp->fin_validite);
114
-    				$dateclose=$db->jdate($objp->date_cloture);
110
+    				$date = $db->jdate($objp->dp);
111
+    				$datec = $db->jdate($objp->datec);
112
+    				$datem = $db->jdate($objp->tms);
113
+    				$dateterm = $db->jdate($objp->fin_validite);
114
+    				$dateclose = $db->jdate($objp->date_cloture);
115 115
                     $propalstatic->id = $objp->rowid;
116 116
                     $propalstatic->ref = $objp->ref;
117 117
                     $propalstatic->total_ht = $objp->total_ht;
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
 
148 148
                     $this->info_box_contents[$line][] = array(
149 149
                         'td' => 'class="right"',
150
-                        'text' => dol_print_date($date,'day'),
150
+                        'text' => dol_print_date($date, 'day'),
151 151
                     );
152 152
 
153 153
                     $this->info_box_contents[$line][] = array(
154 154
                         'td' => 'align="right" width="18"',
155
-                        'text' => $propalstatic->LibStatut($objp->fk_statut,3),
155
+                        'text' => $propalstatic->LibStatut($objp->fk_statut, 3),
156 156
                     );
157 157
 
158 158
                     $line++;
159 159
                 }
160 160
 
161
-                if ($num==0)
161
+                if ($num == 0)
162 162
                     $this->info_box_contents[$line][0] = array(
163 163
                         'td' => 'align="center"',
164 164
                         'text'=>$langs->trans("NoRecordedProposals"),
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *  @param	int		$nooutput	No print, only return string
189 189
 	 *	@return	string
190 190
 	 */
191
-    function showBox($head = null, $contents = null, $nooutput=0)
191
+    function showBox($head = null, $contents = null, $nooutput = 0)
192 192
     {
193 193
         return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
194 194
     }
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,13 +88,22 @@  discard block
 block discarded – undo
88 88
     		$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
89 89
     		$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
90 90
     		$sql.= ", ".MAIN_DB_PREFIX."propal as p";
91
-    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
91
+    		if (!$user->rights->societe->client->voir && !$user->societe_id) {
92
+    		    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
93
+    		}
92 94
     		$sql.= " WHERE p.fk_soc = s.rowid";
93 95
     		$sql.= " AND p.entity = ".$conf->entity;
94
-    		if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
95
-    		if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
96
-            if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC ";
97
-            else $sql.= " ORDER BY p.tms DESC, p.ref DESC ";
96
+    		if (!$user->rights->societe->client->voir && !$user->societe_id) {
97
+    		    $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
98
+    		}
99
+    		if($user->societe_id) {
100
+    		    $sql.= " AND s.rowid = ".$user->societe_id;
101
+    		}
102
+            if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) {
103
+                $sql.= " ORDER BY p.datep DESC, p.ref DESC ";
104
+            } else {
105
+                $sql.= " ORDER BY p.tms DESC, p.ref DESC ";
106
+            }
98 107
     		$sql.= $db->plimit($max, 0);
99 108
 
100 109
     		$result = $db->query($sql);
@@ -158,11 +167,12 @@  discard block
 block discarded – undo
158 167
                     $line++;
159 168
                 }
160 169
 
161
-                if ($num==0)
162
-                    $this->info_box_contents[$line][0] = array(
170
+                if ($num==0) {
171
+                                    $this->info_box_contents[$line][0] = array(
163 172
                         'td' => 'align="center"',
164 173
                         'text'=>$langs->trans("NoRecordedProposals"),
165 174
                     );
175
+                }
166 176
 
167 177
                 $db->free($result);
168 178
             } else {
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_project.php 3 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -30,20 +30,20 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class box_project extends ModeleBoxes
32 32
 {
33
-	var $boxcode="project";
34
-	var $boximg="object_projectpub";
35
-	var $boxlabel;
36
-	//var $depends = array("projet");
33
+    var $boxcode="project";
34
+    var $boximg="object_projectpub";
35
+    var $boxlabel;
36
+    //var $depends = array("projet");
37 37
 
38
-	/**
38
+    /**
39 39
      * @var DoliDB Database handler.
40 40
      */
41 41
     public $db;
42 42
 
43
-	var $param;
43
+    var $param;
44 44
 
45
-	var $info_box_head = array();
46
-	var $info_box_contents = array();
45
+    var $info_box_head = array();
46
+    var $info_box_contents = array();
47 47
 
48 48
     /**
49 49
      *  Constructor
@@ -64,49 +64,49 @@  discard block
 block discarded – undo
64 64
         $this->hidden=! ($user->rights->projet->lire);
65 65
     }
66 66
 
67
-	/**
68
-	*  Load data for box to show them later
69
-	*
70
-	*  @param   int		$max        Maximum number of records to load
71
-	*  @return  void
72
-	*/
73
-	function loadBox($max=5)
74
-	{
75
-		global $conf, $user, $langs, $db;
67
+    /**
68
+     *  Load data for box to show them later
69
+     *
70
+     *  @param   int		$max        Maximum number of records to load
71
+     *  @return  void
72
+     */
73
+    function loadBox($max=5)
74
+    {
75
+        global $conf, $user, $langs, $db;
76 76
 
77
-		$this->max=$max;
77
+        $this->max=$max;
78 78
 
79
-		$totalMnt = 0;
80
-		$totalnb = 0;
81
-		$totalnbTask=0;
79
+        $totalMnt = 0;
80
+        $totalnb = 0;
81
+        $totalnbTask=0;
82 82
 
83
-		$textHead = $langs->trans("OpenedProjects");
84
-		$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
83
+        $textHead = $langs->trans("OpenedProjects");
84
+        $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
85 85
 
86
-		// list the summary of the orders
87
-		if ($user->rights->projet->lire) {
86
+        // list the summary of the orders
87
+        if ($user->rights->projet->lire) {
88 88
 
89
-		    include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
90
-		    $projectstatic = new Project($this->db);
89
+            include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
90
+            $projectstatic = new Project($this->db);
91 91
 
92
-		    $socid=$user->societe_id;
92
+            $socid=$user->societe_id;
93 93
 
94
-    		// Get list of project id allowed to user (in a string list separated by coma)
95
-		    $projectsListId='';
96
-    		if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
94
+            // Get list of project id allowed to user (in a string list separated by coma)
95
+            $projectsListId='';
96
+            if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
97 97
 
98
-		    $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
99
-			$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
98
+            $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
99
+            $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
100 100
             if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
101
-			$sql.= " WHERE p.entity IN (".getEntity('project').')';
101
+            $sql.= " WHERE p.entity IN (".getEntity('project').')';
102 102
             if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";     // public and assigned to, or restricted to company for external users
103
-			if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
103
+            if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
104 104
             $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
105 105
             if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
106 106
             if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
107 107
 
108 108
             $sql.= " ORDER BY p.datec DESC";
109
-			//$sql.= $db->plimit($max, 0);
109
+            //$sql.= $db->plimit($max, 0);
110 110
 
111 111
             $result = $db->query($sql);
112 112
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                     $this->info_box_contents[$i][] = array(
125 125
                         'td' => '',
126 126
                         'text' => $projectstatic->getNomUrl(1),
127
-                    	'asis' => 1
127
+                        'asis' => 1
128 128
                     );
129 129
 
130 130
                     $this->info_box_contents[$i][] = array(
@@ -132,46 +132,46 @@  discard block
 block discarded – undo
132 132
                         'text' => $objp->title,
133 133
                     );
134 134
 
135
-					$sql ="SELECT count(*) as nb, sum(progress) as totprogress";
136
-					$sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid";
137
-	           		$sql.= " WHERE p.entity IN (".getEntity('project').')';
138
-    				$sql.=" AND p.rowid = ".$objp->rowid;
139
-					$resultTask = $db->query($sql);
140
-					if ($resultTask) {
141
-						$objTask = $db->fetch_object($resultTask);
135
+                    $sql ="SELECT count(*) as nb, sum(progress) as totprogress";
136
+                    $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid";
137
+                        $sql.= " WHERE p.entity IN (".getEntity('project').')';
138
+                    $sql.=" AND p.rowid = ".$objp->rowid;
139
+                    $resultTask = $db->query($sql);
140
+                    if ($resultTask) {
141
+                        $objTask = $db->fetch_object($resultTask);
142 142
                         $this->info_box_contents[$i][] = array(
143 143
                             'td' => 'class="right"',
144 144
                             'text' => $objTask->nb."&nbsp;".$langs->trans("Tasks"),
145 145
                         );
146
-						if ($objTask->nb  > 0)
146
+                        if ($objTask->nb  > 0)
147 147
                             $this->info_box_contents[$i][] = array(
148 148
                                 'td' => 'class="right"',
149 149
                                 'text' => round($objTask->totprogress/$objTask->nb, 0)."%",
150 150
                             );
151
-						else
152
-							$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
153
-						$totalnbTask += $objTask->nb;
154
-					} else {
155
-						$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0));
156
-						$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
157
-					}
158
-
159
-					$i++;
160
-				}
161
-				if ($max < $num)
162
-				{
163
-				    $this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...');
164
-				    $i++;
165
-				}
166
-			}
167
-		}
168
-
169
-
170
-		// Add the sum à the bottom of the boxes
151
+                        else
152
+                            $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
153
+                        $totalnbTask += $objTask->nb;
154
+                    } else {
155
+                        $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0));
156
+                        $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
157
+                    }
158
+
159
+                    $i++;
160
+                }
161
+                if ($max < $num)
162
+                {
163
+                    $this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...');
164
+                    $i++;
165
+                }
166
+            }
167
+        }
168
+
169
+
170
+        // Add the sum à the bottom of the boxes
171 171
         $this->info_box_contents[$i][] = array(
172 172
             'td' => '',
173 173
             'text' => $langs->trans("Total")."&nbsp;".$textHead,
174
-             'text' => "&nbsp;",
174
+                'text' => "&nbsp;",
175 175
         );
176 176
         $this->info_box_contents[$i][] = array(
177 177
             'td' => 'align="right" ',
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
             'td' => '',
186 186
             'text' => "&nbsp;",
187 187
         );
188
-	}
189
-
190
-	/**
191
-	 *	Method to show box
192
-	 *
193
-	 *	@param	array	$head       Array with properties of box title
194
-	 *	@param  array	$contents   Array with properties of box lines
195
-	 *  @param	int		$nooutput	No print, only return string
196
-	 *	@return	string
197
-	 */
188
+    }
189
+
190
+    /**
191
+     *	Method to show box
192
+     *
193
+     *	@param	array	$head       Array with properties of box title
194
+     *	@param  array	$contents   Array with properties of box lines
195
+     *  @param	int		$nooutput	No print, only return string
196
+     *	@return	string
197
+     */
198 198
     function showBox($head = null, $contents = null, $nooutput=0)
199 199
     {
200
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
201
-	}
200
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
201
+    }
202 202
 }
203 203
 
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class box_project extends ModeleBoxes
32 32
 {
33
-	var $boxcode="project";
34
-	var $boximg="object_projectpub";
33
+	var $boxcode = "project";
34
+	var $boximg = "object_projectpub";
35 35
 	var $boxlabel;
36 36
 	//var $depends = array("projet");
37 37
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *  @param  DoliDB  $db         Database handler
52 52
      *  @param  string  $param      More parameters
53 53
      */
54
-    function __construct($db,$param='')
54
+    function __construct($db, $param = '')
55 55
     {
56 56
         global $user, $langs;
57 57
 
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
         $langs->loadLangs(array('boxes', 'projects'));
60 60
 
61 61
         $this->db = $db;
62
-        $this->boxlabel="Projects";
62
+        $this->boxlabel = "Projects";
63 63
 
64
-        $this->hidden=! ($user->rights->projet->lire);
64
+        $this->hidden = !($user->rights->projet->lire);
65 65
     }
66 66
 
67 67
 	/**
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 	*  @param   int		$max        Maximum number of records to load
71 71
 	*  @return  void
72 72
 	*/
73
-	function loadBox($max=5)
73
+	function loadBox($max = 5)
74 74
 	{
75 75
 		global $conf, $user, $langs, $db;
76 76
 
77
-		$this->max=$max;
77
+		$this->max = $max;
78 78
 
79 79
 		$totalMnt = 0;
80 80
 		$totalnb = 0;
81
-		$totalnbTask=0;
81
+		$totalnbTask = 0;
82 82
 
83 83
 		$textHead = $langs->trans("OpenedProjects");
84 84
 		$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
@@ -89,23 +89,23 @@  discard block
 block discarded – undo
89 89
 		    include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
90 90
 		    $projectstatic = new Project($this->db);
91 91
 
92
-		    $socid=$user->societe_id;
92
+		    $socid = $user->societe_id;
93 93
 
94 94
     		// Get list of project id allowed to user (in a string list separated by coma)
95
-		    $projectsListId='';
96
-    		if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
95
+		    $projectsListId = '';
96
+    		if (!$user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
97 97
 
98 98
 		    $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
99
-			$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
100
-            if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
101
-			$sql.= " WHERE p.entity IN (".getEntity('project').')';
102
-            if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";     // public and assigned to, or restricted to company for external users
103
-			if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
104
-            $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
105
-            if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
106
-            if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
107
-
108
-            $sql.= " ORDER BY p.datec DESC";
99
+			$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
100
+            if ($user->socid) $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
101
+			$sql .= " WHERE p.entity IN (".getEntity('project').')';
102
+            if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
103
+			if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
104
+            $sql .= " AND p.fk_statut = 1"; // Seulement les projets ouverts
105
+            if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
106
+            if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id.") OR (s.rowid IS NULL))";
107
+
108
+            $sql .= " ORDER BY p.datec DESC";
109 109
 			//$sql.= $db->plimit($max, 0);
110 110
 
111 111
             $result = $db->query($sql);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
                         'text' => $objp->title,
133 133
                     );
134 134
 
135
-					$sql ="SELECT count(*) as nb, sum(progress) as totprogress";
136
-					$sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid";
137
-	           		$sql.= " WHERE p.entity IN (".getEntity('project').')';
138
-    				$sql.=" AND p.rowid = ".$objp->rowid;
135
+					$sql = "SELECT count(*) as nb, sum(progress) as totprogress";
136
+					$sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid";
137
+	           		$sql .= " WHERE p.entity IN (".getEntity('project').')';
138
+    				$sql .= " AND p.rowid = ".$objp->rowid;
139 139
 					$resultTask = $db->query($sql);
140 140
 					if ($resultTask) {
141 141
 						$objTask = $db->fetch_object($resultTask);
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
                             'td' => 'class="right"',
144 144
                             'text' => $objTask->nb."&nbsp;".$langs->trans("Tasks"),
145 145
                         );
146
-						if ($objTask->nb  > 0)
146
+						if ($objTask->nb > 0)
147 147
                             $this->info_box_contents[$i][] = array(
148 148
                                 'td' => 'class="right"',
149
-                                'text' => round($objTask->totprogress/$objTask->nb, 0)."%",
149
+                                'text' => round($objTask->totprogress / $objTask->nb, 0)."%",
150 150
                             );
151 151
 						else
152 152
 							$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 *  @param	int		$nooutput	No print, only return string
196 196
 	 *	@return	string
197 197
 	 */
198
-    function showBox($head = null, $contents = null, $nooutput=0)
198
+    function showBox($head = null, $contents = null, $nooutput = 0)
199 199
     {
200 200
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
201 201
 	}
Please login to merge, or discard this patch.
Braces   +24 added lines, -10 removed lines patch added patch discarded remove patch
@@ -93,17 +93,30 @@  discard block
 block discarded – undo
93 93
 
94 94
     		// Get list of project id allowed to user (in a string list separated by coma)
95 95
 		    $projectsListId='';
96
-    		if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
96
+    		if (! $user->rights->projet->all->lire) {
97
+    		    $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
98
+    		}
97 99
 
98 100
 		    $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
99 101
 			$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
100
-            if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
102
+            if($user->socid) {
103
+                $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
104
+            }
101 105
 			$sql.= " WHERE p.entity IN (".getEntity('project').')';
102
-            if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";     // public and assigned to, or restricted to company for external users
103
-			if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
106
+            if (! $user->rights->projet->all->lire) {
107
+                $sql.= " AND p.rowid IN (".$projectsListId.")";
108
+            }
109
+            // public and assigned to, or restricted to company for external users
110
+			if ($user->socid) {
111
+			    $sql.= " AND s.rowid = ".$user->socid;
112
+			}
104 113
             $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
105
-            if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
106
-            if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
114
+            if ($socid) {
115
+                $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
116
+            }
117
+            if (! $user->rights->societe->client->voir && ! $socid) {
118
+                $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
119
+            }
107 120
 
108 121
             $sql.= " ORDER BY p.datec DESC";
109 122
 			//$sql.= $db->plimit($max, 0);
@@ -143,13 +156,14 @@  discard block
 block discarded – undo
143 156
                             'td' => 'class="right"',
144 157
                             'text' => $objTask->nb."&nbsp;".$langs->trans("Tasks"),
145 158
                         );
146
-						if ($objTask->nb  > 0)
147
-                            $this->info_box_contents[$i][] = array(
159
+						if ($objTask->nb  > 0) {
160
+						                            $this->info_box_contents[$i][] = array(
148 161
                                 'td' => 'class="right"',
149 162
                                 'text' => round($objTask->totprogress/$objTask->nb, 0)."%",
150 163
                             );
151
-						else
152
-							$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
164
+						} else {
165
+													$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
166
+						}
153 167
 						$totalnbTask += $objTask->nb;
154 168
 					} else {
155 169
 						$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0));
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_graph_propales_permonth.php 3 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -28,257 +28,257 @@
 block discarded – undo
28 28
  */
29 29
 class box_graph_propales_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="propalpermonth";
32
-	var $boximg="object_propal";
33
-	var $boxlabel="BoxProposalsPerMonth";
34
-	var $depends = array("propal");
31
+    var $boxcode="propalpermonth";
32
+    var $boximg="object_propal";
33
+    var $boxlabel="BoxProposalsPerMonth";
34
+    var $depends = array("propal");
35 35
 
36
-	/**
36
+    /**
37 37
      * @var DoliDB Database handler.
38 38
      */
39 39
     public $db;
40 40
 
41
-	var $info_box_head = array();
42
-	var $info_box_contents = array();
41
+    var $info_box_head = array();
42
+    var $info_box_contents = array();
43 43
 
44 44
 
45
-	/**
46
-	 *  Constructor
47
-	 *
48
-	 * 	@param	DoliDB	$db			Database handler
49
-	 *  @param	string	$param		More parameters
50
-	 */
51
-	function __construct($db,$param)
52
-	{
53
-		global $user;
45
+    /**
46
+     *  Constructor
47
+     *
48
+     * 	@param	DoliDB	$db			Database handler
49
+     *  @param	string	$param		More parameters
50
+     */
51
+    function __construct($db,$param)
52
+    {
53
+        global $user;
54 54
 
55
-		$this->db=$db;
55
+        $this->db=$db;
56 56
 
57
-		$this->hidden=! ($user->rights->propale->lire);
58
-	}
57
+        $this->hidden=! ($user->rights->propale->lire);
58
+    }
59 59
 
60
-	/**
61
-	 *  Load data into info_box_contents array to show array later.
62
-	 *
63
-	 *  @param	int		$max        Maximum number of records to load
60
+    /**
61
+     *  Load data into info_box_contents array to show array later.
62
+     *
63
+     *  @param	int		$max        Maximum number of records to load
64 64
      *  @return	void
65
-	 */
66
-	function loadBox($max=5)
67
-	{
68
-		global $conf, $user, $langs, $db;
65
+     */
66
+    function loadBox($max=5)
67
+    {
68
+        global $conf, $user, $langs, $db;
69 69
 
70
-		$this->max=$max;
70
+        $this->max=$max;
71 71
 
72
-		$refreshaction='refresh_'.$this->boxcode;
72
+        $refreshaction='refresh_'.$this->boxcode;
73 73
 
74
-		//include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
75
-		//$propalstatic=new Propal($db);
74
+        //include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
75
+        //$propalstatic=new Propal($db);
76 76
 
77
-		$langs->load("propal");
77
+        $langs->load("propal");
78 78
 
79
-		$text = $langs->trans("BoxProposalsPerMonth",$max);
80
-		$this->info_box_head = array(
81
-				'text' => $text,
82
-				'limit'=> dol_strlen($text),
83
-				'graph'=> 1,		// Set to 1 if it's a box graph
84
-				'sublink'=>'',
85
-				'subtext'=>$langs->trans("Filter"),
86
-				'subpicto'=>'filter.png',
87
-				'subclass'=>'linkobject boxfilter',
88
-				'target'=>'none'	// Set '' to get target="_blank"
89
-		);
79
+        $text = $langs->trans("BoxProposalsPerMonth",$max);
80
+        $this->info_box_head = array(
81
+                'text' => $text,
82
+                'limit'=> dol_strlen($text),
83
+                'graph'=> 1,		// Set to 1 if it's a box graph
84
+                'sublink'=>'',
85
+                'subtext'=>$langs->trans("Filter"),
86
+                'subpicto'=>'filter.png',
87
+                'subclass'=>'linkobject boxfilter',
88
+                'target'=>'none'	// Set '' to get target="_blank"
89
+        );
90 90
 
91
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
92
-		$prefix='';
93
-		$socid=0;
94
-		if ($user->societe_id) $socid=$user->societe_id;
95
-		if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
91
+        $dir=''; 	// We don't need a path because image file will not be saved into disk
92
+        $prefix='';
93
+        $socid=0;
94
+        if ($user->societe_id) $socid=$user->societe_id;
95
+        if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
96 96
 
97
-		if ($user->rights->propale->lire)
98
-		{
99
-			$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
97
+        if ($user->rights->propale->lire)
98
+        {
99
+            $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
+            $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
+            $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
102 102
 
103
-			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104
-			include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
105
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
106
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
107
-			{
108
-				$endyear=GETPOST($param_year,'int');
109
-				$shownb=GETPOST($param_shownb,'alpha');
110
-				$showtot=GETPOST($param_showtot,'alpha');
111
-			}
112
-			else
113
-			{
114
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115
-				$endyear=$tmparray['year'];
116
-				$shownb=$tmparray['shownb'];
117
-				$showtot=$tmparray['showtot'];
118
-			}
119
-			if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
120
-			$nowarray=dol_getdate(dol_now(),true);
121
-			if (empty($endyear)) $endyear=$nowarray['year'];
122
-			$startyear=$endyear-1;
123
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
124
-			$HEIGHT='192';
103
+            include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104
+            include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
105
+            $autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
106
+            if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
107
+            {
108
+                $endyear=GETPOST($param_year,'int');
109
+                $shownb=GETPOST($param_shownb,'alpha');
110
+                $showtot=GETPOST($param_showtot,'alpha');
111
+            }
112
+            else
113
+            {
114
+                $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115
+                $endyear=$tmparray['year'];
116
+                $shownb=$tmparray['shownb'];
117
+                $showtot=$tmparray['showtot'];
118
+            }
119
+            if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
120
+            $nowarray=dol_getdate(dol_now(),true);
121
+            if (empty($endyear)) $endyear=$nowarray['year'];
122
+            $startyear=$endyear-1;
123
+            $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
124
+            $HEIGHT='192';
125 125
 
126
-			$stats = new PropaleStats($this->db, $socid, 0);
126
+            $stats = new PropaleStats($this->db, $socid, 0);
127 127
 
128
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
129
-			if ($shownb)
130
-			{
131
-				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
132
-				$datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars');
128
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
129
+            if ($shownb)
130
+            {
131
+                $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
132
+                $datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars');
133 133
 
134
-				$filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png";
135
-				$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsnbinyear-'.$endyear.'.png';
134
+                $filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png";
135
+                $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsnbinyear-'.$endyear.'.png';
136 136
 
137
-				$px1 = new DolGraph();
138
-				$mesg = $px1->isGraphKo();
139
-				if (! $mesg)
140
-				{
141
-					$px1->SetType($datatype1);
142
-					$px1->SetData($data1);
143
-					unset($data1);
144
-					$px1->SetPrecisionY(0);
145
-					$i=$startyear;$legend=array();
146
-					while ($i <= $endyear)
147
-					{
148
-						$legend[]=$i;
149
-						$i++;
150
-					}
151
-					$px1->SetLegend($legend);
152
-					$px1->SetMaxValue($px1->GetCeilMaxValue());
153
-					$px1->SetWidth($WIDTH);
154
-					$px1->SetHeight($HEIGHT);
155
-					$px1->SetYLabel($langs->trans("NumberOfProposals"));
156
-					$px1->SetShading(3);
157
-					$px1->SetHorizTickIncrement(1);
158
-					$px1->SetPrecisionY(0);
159
-					$px1->SetCssPrefix("cssboxes");
160
-					$px1->mode='depth';
161
-					$px1->SetTitle($langs->trans("NumberOfProposalsByMonth"));
137
+                $px1 = new DolGraph();
138
+                $mesg = $px1->isGraphKo();
139
+                if (! $mesg)
140
+                {
141
+                    $px1->SetType($datatype1);
142
+                    $px1->SetData($data1);
143
+                    unset($data1);
144
+                    $px1->SetPrecisionY(0);
145
+                    $i=$startyear;$legend=array();
146
+                    while ($i <= $endyear)
147
+                    {
148
+                        $legend[]=$i;
149
+                        $i++;
150
+                    }
151
+                    $px1->SetLegend($legend);
152
+                    $px1->SetMaxValue($px1->GetCeilMaxValue());
153
+                    $px1->SetWidth($WIDTH);
154
+                    $px1->SetHeight($HEIGHT);
155
+                    $px1->SetYLabel($langs->trans("NumberOfProposals"));
156
+                    $px1->SetShading(3);
157
+                    $px1->SetHorizTickIncrement(1);
158
+                    $px1->SetPrecisionY(0);
159
+                    $px1->SetCssPrefix("cssboxes");
160
+                    $px1->mode='depth';
161
+                    $px1->SetTitle($langs->trans("NumberOfProposalsByMonth"));
162 162
 
163
-					$px1->draw($filenamenb,$fileurlnb);
164
-				}
165
-			}
163
+                    $px1->draw($filenamenb,$fileurlnb);
164
+                }
165
+            }
166 166
 
167
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
168
-			if ($showtot)
169
-			{
170
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
171
-				$datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars');
172
-				//$datatype2 = array('lines','bars');
167
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
168
+            if ($showtot)
169
+            {
170
+                $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
171
+                $datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars');
172
+                //$datatype2 = array('lines','bars');
173 173
 
174
-				$filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png";
175
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsamountinyear-'.$endyear.'.png';
176
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&amp;file=propalsamountinyear-'.$endyear.'.png';
174
+                $filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png";
175
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsamountinyear-'.$endyear.'.png';
176
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&amp;file=propalsamountinyear-'.$endyear.'.png';
177 177
 
178
-				$px2 = new DolGraph();
179
-				$mesg = $px2->isGraphKo();
180
-				if (! $mesg)
181
-				{
182
-					$px2->SetType($datatype2);
183
-					$px2->SetData($data2);
184
-					unset($data2);
185
-					$px2->SetPrecisionY(0);
186
-					$i=$startyear;$legend=array();
187
-					while ($i <= $endyear)
188
-					{
189
-						$legend[]=$i;
190
-						$i++;
191
-					}
192
-					$px2->SetLegend($legend);
193
-					$px2->SetMaxValue($px2->GetCeilMaxValue());
194
-					$px2->SetWidth($WIDTH);
195
-					$px2->SetHeight($HEIGHT);
196
-					$px2->SetYLabel($langs->trans("AmountOfProposalsHT"));
197
-					$px2->SetShading(3);
198
-					$px2->SetHorizTickIncrement(1);
199
-					$px2->SetPrecisionY(0);
200
-					$px2->SetCssPrefix("cssboxes");
201
-					$px2->mode='depth';
202
-					$px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT"));
178
+                $px2 = new DolGraph();
179
+                $mesg = $px2->isGraphKo();
180
+                if (! $mesg)
181
+                {
182
+                    $px2->SetType($datatype2);
183
+                    $px2->SetData($data2);
184
+                    unset($data2);
185
+                    $px2->SetPrecisionY(0);
186
+                    $i=$startyear;$legend=array();
187
+                    while ($i <= $endyear)
188
+                    {
189
+                        $legend[]=$i;
190
+                        $i++;
191
+                    }
192
+                    $px2->SetLegend($legend);
193
+                    $px2->SetMaxValue($px2->GetCeilMaxValue());
194
+                    $px2->SetWidth($WIDTH);
195
+                    $px2->SetHeight($HEIGHT);
196
+                    $px2->SetYLabel($langs->trans("AmountOfProposalsHT"));
197
+                    $px2->SetShading(3);
198
+                    $px2->SetHorizTickIncrement(1);
199
+                    $px2->SetPrecisionY(0);
200
+                    $px2->SetCssPrefix("cssboxes");
201
+                    $px2->mode='depth';
202
+                    $px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT"));
203 203
 
204
-					$px2->draw($filenamenb,$fileurlnb);
205
-				}
206
-			}
204
+                    $px2->draw($filenamenb,$fileurlnb);
205
+                }
206
+            }
207 207
 
208
-			if (empty($conf->use_javascript_ajax))
209
-			{
210
-				$langs->load("errors");
211
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
212
-			}
208
+            if (empty($conf->use_javascript_ajax))
209
+            {
210
+                $langs->load("errors");
211
+                $mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
212
+            }
213 213
 
214
-			if (! $mesg)
215
-			{
216
-				$stringtoshow='';
217
-				$stringtoshow.='<script type="text/javascript" language="javascript">
214
+            if (! $mesg)
215
+            {
216
+                $stringtoshow='';
217
+                $stringtoshow.='<script type="text/javascript" language="javascript">
218 218
 					jQuery(document).ready(function() {
219 219
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
220 220
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
221 221
 						});
222 222
 					});
223 223
 					</script>';
224
-				$stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
225
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
226
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
227
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
228
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
229
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfProposalsByMonth");
230
-				$stringtoshow.=' &nbsp; ';
231
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfProposalsByMonthHT");
232
-				$stringtoshow.='<br>';
233
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
234
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
235
-				$stringtoshow.='</form>';
236
-				$stringtoshow.='</div>';
237
-				if ($shownb && $showtot)
238
-				{
239
-					$stringtoshow.='<div class="fichecenter">';
240
-					$stringtoshow.='<div class="fichehalfleft">';
241
-				}
242
-				if ($shownb) $stringtoshow.=$px1->show();
243
-				if ($shownb && $showtot)
244
-				{
245
-					$stringtoshow.='</div>';
246
-					$stringtoshow.='<div class="fichehalfright">';
247
-				}
248
-				if ($showtot) $stringtoshow.=$px2->show();
249
-				if ($shownb && $showtot)
250
-				{
251
-					$stringtoshow.='</div>';
252
-					$stringtoshow.='</div>';
253
-				}
254
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
255
-			}
256
-			else
257
-			{
258
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
259
-    	        										'maxlength'=>500,
260
-	            										'text' => $mesg);
261
-			}
262
-		}
263
-		else {
264
-			$this->info_box_contents[0][0] = array(
265
-			    'td' => 'align="left" class="nohover opacitymedium"',
224
+                $stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
225
+                $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
226
+                $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
227
+                $stringtoshow.='<input type="hidden" name="page_y" value="">';
228
+                $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
229
+                $stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfProposalsByMonth");
230
+                $stringtoshow.=' &nbsp; ';
231
+                $stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfProposalsByMonthHT");
232
+                $stringtoshow.='<br>';
233
+                $stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
234
+                $stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
235
+                $stringtoshow.='</form>';
236
+                $stringtoshow.='</div>';
237
+                if ($shownb && $showtot)
238
+                {
239
+                    $stringtoshow.='<div class="fichecenter">';
240
+                    $stringtoshow.='<div class="fichehalfleft">';
241
+                }
242
+                if ($shownb) $stringtoshow.=$px1->show();
243
+                if ($shownb && $showtot)
244
+                {
245
+                    $stringtoshow.='</div>';
246
+                    $stringtoshow.='<div class="fichehalfright">';
247
+                }
248
+                if ($showtot) $stringtoshow.=$px2->show();
249
+                if ($shownb && $showtot)
250
+                {
251
+                    $stringtoshow.='</div>';
252
+                    $stringtoshow.='</div>';
253
+                }
254
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
255
+            }
256
+            else
257
+            {
258
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
259
+                                                        'maxlength'=>500,
260
+                                                        'text' => $mesg);
261
+            }
262
+        }
263
+        else {
264
+            $this->info_box_contents[0][0] = array(
265
+                'td' => 'align="left" class="nohover opacitymedium"',
266 266
                 'text' => $langs->trans("ReadPermissionNotAllowed")
267
-			);
268
-		}
269
-	}
267
+            );
268
+        }
269
+    }
270 270
 
271
-	/**
272
-	 *	Method to show box
273
-	 *
274
-	 *	@param	array	$head       Array with properties of box title
275
-	 *	@param  array	$contents   Array with properties of box lines
276
-	 *  @param	int		$nooutput	No print, only return string
277
-	 *	@return	string
278
-	 */
271
+    /**
272
+     *	Method to show box
273
+     *
274
+     *	@param	array	$head       Array with properties of box title
275
+     *	@param  array	$contents   Array with properties of box lines
276
+     *  @param	int		$nooutput	No print, only return string
277
+     *	@return	string
278
+     */
279 279
     function showBox($head = null, $contents = null, $nooutput=0)
280 280
     {
281
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
282
-	}
281
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
282
+    }
283 283
 }
284 284
 
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class box_graph_propales_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="propalpermonth";
32
-	var $boximg="object_propal";
33
-	var $boxlabel="BoxProposalsPerMonth";
31
+	var $boxcode = "propalpermonth";
32
+	var $boximg = "object_propal";
33
+	var $boxlabel = "BoxProposalsPerMonth";
34 34
 	var $depends = array("propal");
35 35
 
36 36
 	/**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	 * 	@param	DoliDB	$db			Database handler
49 49
 	 *  @param	string	$param		More parameters
50 50
 	 */
51
-	function __construct($db,$param)
51
+	function __construct($db, $param)
52 52
 	{
53 53
 		global $user;
54 54
 
55
-		$this->db=$db;
55
+		$this->db = $db;
56 56
 
57
-		$this->hidden=! ($user->rights->propale->lire);
57
+		$this->hidden = !($user->rights->propale->lire);
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 	 *  @param	int		$max        Maximum number of records to load
64 64
      *  @return	void
65 65
 	 */
66
-	function loadBox($max=5)
66
+	function loadBox($max = 5)
67 67
 	{
68 68
 		global $conf, $user, $langs, $db;
69 69
 
70
-		$this->max=$max;
70
+		$this->max = $max;
71 71
 
72
-		$refreshaction='refresh_'.$this->boxcode;
72
+		$refreshaction = 'refresh_'.$this->boxcode;
73 73
 
74 74
 		//include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
75 75
 		//$propalstatic=new Propal($db);
76 76
 
77 77
 		$langs->load("propal");
78 78
 
79
-		$text = $langs->trans("BoxProposalsPerMonth",$max);
79
+		$text = $langs->trans("BoxProposalsPerMonth", $max);
80 80
 		$this->info_box_head = array(
81 81
 				'text' => $text,
82 82
 				'limit'=> dol_strlen($text),
83
-				'graph'=> 1,		// Set to 1 if it's a box graph
83
+				'graph'=> 1, // Set to 1 if it's a box graph
84 84
 				'sublink'=>'',
85 85
 				'subtext'=>$langs->trans("Filter"),
86 86
 				'subpicto'=>'filter.png',
@@ -88,64 +88,64 @@  discard block
 block discarded – undo
88 88
 				'target'=>'none'	// Set '' to get target="_blank"
89 89
 		);
90 90
 
91
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
92
-		$prefix='';
93
-		$socid=0;
94
-		if ($user->societe_id) $socid=$user->societe_id;
95
-		if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
91
+		$dir = ''; // We don't need a path because image file will not be saved into disk
92
+		$prefix = '';
93
+		$socid = 0;
94
+		if ($user->societe_id) $socid = $user->societe_id;
95
+		if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
96 96
 
97 97
 		if ($user->rights->propale->lire)
98 98
 		{
99
-			$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
99
+			$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
100
+			$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
101
+			$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
102 102
 
103 103
 			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104 104
 			include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
105
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
106
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
105
+			$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
106
+			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
107 107
 			{
108
-				$endyear=GETPOST($param_year,'int');
109
-				$shownb=GETPOST($param_shownb,'alpha');
110
-				$showtot=GETPOST($param_showtot,'alpha');
108
+				$endyear = GETPOST($param_year, 'int');
109
+				$shownb = GETPOST($param_shownb, 'alpha');
110
+				$showtot = GETPOST($param_showtot, 'alpha');
111 111
 			}
112 112
 			else
113 113
 			{
114
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115
-				$endyear=$tmparray['year'];
116
-				$shownb=$tmparray['shownb'];
117
-				$showtot=$tmparray['showtot'];
114
+				$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
115
+				$endyear = $tmparray['year'];
116
+				$shownb = $tmparray['shownb'];
117
+				$showtot = $tmparray['showtot'];
118 118
 			}
119
-			if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
120
-			$nowarray=dol_getdate(dol_now(),true);
121
-			if (empty($endyear)) $endyear=$nowarray['year'];
122
-			$startyear=$endyear-1;
123
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
124
-			$HEIGHT='192';
119
+			if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
120
+			$nowarray = dol_getdate(dol_now(), true);
121
+			if (empty($endyear)) $endyear = $nowarray['year'];
122
+			$startyear = $endyear - 1;
123
+			$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
124
+			$HEIGHT = '192';
125 125
 
126 126
 			$stats = new PropaleStats($this->db, $socid, 0);
127 127
 
128 128
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
129 129
 			if ($shownb)
130 130
 			{
131
-				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
132
-				$datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars');
131
+				$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
132
+				$datatype1 = array_pad(array(), ($endyear - $startyear + 1), 'bars');
133 133
 
134 134
 				$filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png";
135 135
 				$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsnbinyear-'.$endyear.'.png';
136 136
 
137 137
 				$px1 = new DolGraph();
138 138
 				$mesg = $px1->isGraphKo();
139
-				if (! $mesg)
139
+				if (!$mesg)
140 140
 				{
141 141
 					$px1->SetType($datatype1);
142 142
 					$px1->SetData($data1);
143 143
 					unset($data1);
144 144
 					$px1->SetPrecisionY(0);
145
-					$i=$startyear;$legend=array();
145
+					$i = $startyear; $legend = array();
146 146
 					while ($i <= $endyear)
147 147
 					{
148
-						$legend[]=$i;
148
+						$legend[] = $i;
149 149
 						$i++;
150 150
 					}
151 151
 					$px1->SetLegend($legend);
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
 					$px1->SetHorizTickIncrement(1);
158 158
 					$px1->SetPrecisionY(0);
159 159
 					$px1->SetCssPrefix("cssboxes");
160
-					$px1->mode='depth';
160
+					$px1->mode = 'depth';
161 161
 					$px1->SetTitle($langs->trans("NumberOfProposalsByMonth"));
162 162
 
163
-					$px1->draw($filenamenb,$fileurlnb);
163
+					$px1->draw($filenamenb, $fileurlnb);
164 164
 				}
165 165
 			}
166 166
 
167 167
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
168 168
 			if ($showtot)
169 169
 			{
170
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
171
-				$datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars');
170
+				$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
171
+				$datatype2 = array_pad(array(), ($endyear - $startyear + 1), 'bars');
172 172
 				//$datatype2 = array('lines','bars');
173 173
 
174 174
 				$filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png";
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 
178 178
 				$px2 = new DolGraph();
179 179
 				$mesg = $px2->isGraphKo();
180
-				if (! $mesg)
180
+				if (!$mesg)
181 181
 				{
182 182
 					$px2->SetType($datatype2);
183 183
 					$px2->SetData($data2);
184 184
 					unset($data2);
185 185
 					$px2->SetPrecisionY(0);
186
-					$i=$startyear;$legend=array();
186
+					$i = $startyear; $legend = array();
187 187
 					while ($i <= $endyear)
188 188
 					{
189
-						$legend[]=$i;
189
+						$legend[] = $i;
190 190
 						$i++;
191 191
 					}
192 192
 					$px2->SetLegend($legend);
@@ -198,64 +198,64 @@  discard block
 block discarded – undo
198 198
 					$px2->SetHorizTickIncrement(1);
199 199
 					$px2->SetPrecisionY(0);
200 200
 					$px2->SetCssPrefix("cssboxes");
201
-					$px2->mode='depth';
201
+					$px2->mode = 'depth';
202 202
 					$px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT"));
203 203
 
204
-					$px2->draw($filenamenb,$fileurlnb);
204
+					$px2->draw($filenamenb, $fileurlnb);
205 205
 				}
206 206
 			}
207 207
 
208 208
 			if (empty($conf->use_javascript_ajax))
209 209
 			{
210 210
 				$langs->load("errors");
211
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
211
+				$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
212 212
 			}
213 213
 
214
-			if (! $mesg)
214
+			if (!$mesg)
215 215
 			{
216
-				$stringtoshow='';
217
-				$stringtoshow.='<script type="text/javascript" language="javascript">
216
+				$stringtoshow = '';
217
+				$stringtoshow .= '<script type="text/javascript" language="javascript">
218 218
 					jQuery(document).ready(function() {
219 219
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
220 220
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
221 221
 						});
222 222
 					});
223 223
 					</script>';
224
-				$stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
225
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
226
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
227
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
228
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
229
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfProposalsByMonth");
230
-				$stringtoshow.=' &nbsp; ';
231
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfProposalsByMonthHT");
232
-				$stringtoshow.='<br>';
233
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
234
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
235
-				$stringtoshow.='</form>';
236
-				$stringtoshow.='</div>';
224
+				$stringtoshow .= '<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
225
+				$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
226
+				$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
227
+				$stringtoshow .= '<input type="hidden" name="page_y" value="">';
228
+				$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
229
+				$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfProposalsByMonth");
230
+				$stringtoshow .= ' &nbsp; ';
231
+				$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfProposalsByMonthHT");
232
+				$stringtoshow .= '<br>';
233
+				$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
234
+				$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
235
+				$stringtoshow .= '</form>';
236
+				$stringtoshow .= '</div>';
237 237
 				if ($shownb && $showtot)
238 238
 				{
239
-					$stringtoshow.='<div class="fichecenter">';
240
-					$stringtoshow.='<div class="fichehalfleft">';
239
+					$stringtoshow .= '<div class="fichecenter">';
240
+					$stringtoshow .= '<div class="fichehalfleft">';
241 241
 				}
242
-				if ($shownb) $stringtoshow.=$px1->show();
242
+				if ($shownb) $stringtoshow .= $px1->show();
243 243
 				if ($shownb && $showtot)
244 244
 				{
245
-					$stringtoshow.='</div>';
246
-					$stringtoshow.='<div class="fichehalfright">';
245
+					$stringtoshow .= '</div>';
246
+					$stringtoshow .= '<div class="fichehalfright">';
247 247
 				}
248
-				if ($showtot) $stringtoshow.=$px2->show();
248
+				if ($showtot) $stringtoshow .= $px2->show();
249 249
 				if ($shownb && $showtot)
250 250
 				{
251
-					$stringtoshow.='</div>';
252
-					$stringtoshow.='</div>';
251
+					$stringtoshow .= '</div>';
252
+					$stringtoshow .= '</div>';
253 253
 				}
254
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
254
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"', 'textnoformat'=>$stringtoshow);
255 255
 			}
256 256
 			else
257 257
 			{
258
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
258
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"',
259 259
     	        										'maxlength'=>500,
260 260
 	            										'text' => $mesg);
261 261
 			}
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 *  @param	int		$nooutput	No print, only return string
277 277
 	 *	@return	string
278 278
 	 */
279
-    function showBox($head = null, $contents = null, $nooutput=0)
279
+    function showBox($head = null, $contents = null, $nooutput = 0)
280 280
     {
281 281
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
282 282
 	}
Please login to merge, or discard this patch.
Braces   +25 added lines, -13 removed lines patch added patch discarded remove patch
@@ -91,8 +91,13 @@  discard block
 block discarded – undo
91 91
 		$dir=''; 	// We don't need a path because image file will not be saved into disk
92 92
 		$prefix='';
93 93
 		$socid=0;
94
-		if ($user->societe_id) $socid=$user->societe_id;
95
-		if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-';	// If user has no permission to see all, output dir is specific to user
94
+		if ($user->societe_id) {
95
+		    $socid=$user->societe_id;
96
+		}
97
+		if (! $user->rights->societe->client->voir || $socid) {
98
+		    $prefix.='private-'.$user->id.'-';
99
+		}
100
+		// If user has no permission to see all, output dir is specific to user
96 101
 
97 102
 		if ($user->rights->propale->lire)
98 103
 		{
@@ -108,8 +113,7 @@  discard block
 block discarded – undo
108 113
 				$endyear=GETPOST($param_year,'int');
109 114
 				$shownb=GETPOST($param_shownb,'alpha');
110 115
 				$showtot=GETPOST($param_showtot,'alpha');
111
-			}
112
-			else
116
+			} else
113 117
 			{
114 118
 				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
115 119
 				$endyear=$tmparray['year'];
@@ -118,7 +122,9 @@  discard block
 block discarded – undo
118 122
 			}
119 123
 			if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
120 124
 			$nowarray=dol_getdate(dol_now(),true);
121
-			if (empty($endyear)) $endyear=$nowarray['year'];
125
+			if (empty($endyear)) {
126
+			    $endyear=$nowarray['year'];
127
+			}
122 128
 			$startyear=$endyear-1;
123 129
 			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
124 130
 			$HEIGHT='192';
@@ -172,8 +178,12 @@  discard block
 block discarded – undo
172 178
 				//$datatype2 = array('lines','bars');
173 179
 
174 180
 				$filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png";
175
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsamountinyear-'.$endyear.'.png';
176
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&amp;file=propalsamountinyear-'.$endyear.'.png';
181
+				if ($mode == 'customer') {
182
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsamountinyear-'.$endyear.'.png';
183
+				}
184
+				if ($mode == 'supplier') {
185
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&amp;file=propalsamountinyear-'.$endyear.'.png';
186
+				}
177 187
 
178 188
 				$px2 = new DolGraph();
179 189
 				$mesg = $px2->isGraphKo();
@@ -239,28 +249,30 @@  discard block
 block discarded – undo
239 249
 					$stringtoshow.='<div class="fichecenter">';
240 250
 					$stringtoshow.='<div class="fichehalfleft">';
241 251
 				}
242
-				if ($shownb) $stringtoshow.=$px1->show();
252
+				if ($shownb) {
253
+				    $stringtoshow.=$px1->show();
254
+				}
243 255
 				if ($shownb && $showtot)
244 256
 				{
245 257
 					$stringtoshow.='</div>';
246 258
 					$stringtoshow.='<div class="fichehalfright">';
247 259
 				}
248
-				if ($showtot) $stringtoshow.=$px2->show();
260
+				if ($showtot) {
261
+				    $stringtoshow.=$px2->show();
262
+				}
249 263
 				if ($shownb && $showtot)
250 264
 				{
251 265
 					$stringtoshow.='</div>';
252 266
 					$stringtoshow.='</div>';
253 267
 				}
254 268
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
255
-			}
256
-			else
269
+			} else
257 270
 			{
258 271
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
259 272
     	        										'maxlength'=>500,
260 273
 	            										'text' => $mesg);
261 274
 			}
262
-		}
263
-		else {
275
+		} else {
264 276
 			$this->info_box_contents[0][0] = array(
265 277
 			    'td' => 'align="left" class="nohover opacitymedium"',
266 278
                 'text' => $langs->trans("ReadPermissionNotAllowed")
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_lastlogin.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -101,16 +101,16 @@
 block discarded – undo
101 101
     }
102 102
 
103 103
 
104
-	/**
105
-	 *	Method to show box
106
-	 *
107
-	 *	@param	array	$head       Array with properties of box title
108
-	 *	@param  array	$contents   Array with properties of box lines
109
-	 *  @param	int		$nooutput	No print, only return string
110
-	 *	@return	void
111
-	 */
104
+    /**
105
+     *	Method to show box
106
+     *
107
+     *	@param	array	$head       Array with properties of box title
108
+     *	@param  array	$contents   Array with properties of box lines
109
+     *  @param	int		$nooutput	No print, only return string
110
+     *	@return	void
111
+     */
112 112
     function showBox($head = null, $contents = null, $nooutput=0)
113 113
     {
114
-		parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
115
-	}
114
+        parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
115
+    }
116 116
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class box_lastlogin extends ModeleBoxes
32 32
 {
33
-    var $boxcode="lastlogin";
34
-    var $boximg="object_user";
35
-    var $boxlabel='BoxLoginInformation';
33
+    var $boxcode = "lastlogin";
34
+    var $boximg = "object_user";
35
+    var $boxlabel = 'BoxLoginInformation';
36 36
     var $depends = array("user");
37 37
 
38 38
     /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      *  @param  DoliDB  $db         Database handler
54 54
      *  @param  string  $param      More parameters
55 55
      */
56
-    function __construct($db,$param)
56
+    function __construct($db, $param)
57 57
     {
58 58
         global $conf;
59 59
 
60
-        $this->db=$db;
60
+        $this->db = $db;
61 61
     }
62 62
 
63 63
     /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *  @param  int     $max        Maximum number of records to load
67 67
      *  @return void
68 68
      */
69
-    function loadBox($max=5)
69
+    function loadBox($max = 5)
70 70
     {
71 71
         global $conf, $user, $langs, $db;
72 72
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             'limit'=> dol_strlen($textHead),
77 77
         );
78 78
         
79
-        $line=0;
79
+        $line = 0;
80 80
         $this->info_box_contents[$line][0] = array(
81 81
             'td' => '',
82 82
             'text' => $langs->trans("User"),
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
             'asis' => 1
88 88
         );
89 89
         
90
-        $line=1;
90
+        $line = 1;
91 91
         $this->info_box_contents[$line][0] = array(
92 92
             'td' => '',
93 93
             'text' => $langs->trans("PreviousConnexion"),
94 94
         );
95
-        if ($user->datepreviouslogin) $tmp= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
96
-        else $tmp= $langs->trans("Unknown");
95
+        if ($user->datepreviouslogin) $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser');
96
+        else $tmp = $langs->trans("Unknown");
97 97
         $this->info_box_contents[$line][1] = array(
98 98
             'td' => '',
99 99
             'text' => $tmp,
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *  @param	int		$nooutput	No print, only return string
110 110
 	 *	@return	void
111 111
 	 */
112
-    function showBox($head = null, $contents = null, $nooutput=0)
112
+    function showBox($head = null, $contents = null, $nooutput = 0)
113 113
     {
114 114
 		parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
115 115
 	}
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,11 @@
 block discarded – undo
92 92
             'td' => '',
93 93
             'text' => $langs->trans("PreviousConnexion"),
94 94
         );
95
-        if ($user->datepreviouslogin) $tmp= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
96
-        else $tmp= $langs->trans("Unknown");
95
+        if ($user->datepreviouslogin) {
96
+            $tmp= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
97
+        } else {
98
+            $tmp= $langs->trans("Unknown");
99
+        }
97 100
         $this->info_box_contents[$line][1] = array(
98 101
             'td' => '',
99 102
             'text' => $tmp,
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_contacts.php 3 patches
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -34,160 +34,160 @@
 block discarded – undo
34 34
  */
35 35
 class box_contacts extends ModeleBoxes
36 36
 {
37
-	var $boxcode="lastcontacts";
38
-	var $boximg="object_contact";
39
-	var $boxlabel="BoxLastContacts";
40
-	var $depends = array("societe");
37
+    var $boxcode="lastcontacts";
38
+    var $boximg="object_contact";
39
+    var $boxlabel="BoxLastContacts";
40
+    var $depends = array("societe");
41 41
 
42
-	/**
42
+    /**
43 43
      * @var DoliDB Database handler.
44 44
      */
45 45
     public $db;
46 46
     
47
-	var $param;
47
+    var $param;
48 48
 
49
-	var $info_box_head = array();
50
-	var $info_box_contents = array();
49
+    var $info_box_head = array();
50
+    var $info_box_contents = array();
51 51
 
52 52
 
53
-	/**
54
-	 *  Constructor
55
-	 *
56
-	 *  @param  DoliDB  $db         Database handler
57
-	 *  @param  string  $param      More parameters
58
-	 */
59
-	function __construct($db,$param)
60
-	{
61
-	    global $user;
53
+    /**
54
+     *  Constructor
55
+     *
56
+     *  @param  DoliDB  $db         Database handler
57
+     *  @param  string  $param      More parameters
58
+     */
59
+    function __construct($db,$param)
60
+    {
61
+        global $user;
62 62
 
63
-	    $this->db=$db;
63
+        $this->db=$db;
64 64
 
65
-	    $this->hidden=! ($user->rights->societe->lire && $user->rights->societe->contact->lire);
66
-	}
65
+        $this->hidden=! ($user->rights->societe->lire && $user->rights->societe->contact->lire);
66
+    }
67 67
 
68
-	/**
69
-	 *  Load data into info_box_contents array to show array later.
70
-	 *
71
-	 *  @param	int		$max        Maximum number of records to load
68
+    /**
69
+     *  Load data into info_box_contents array to show array later.
70
+     *
71
+     *  @param	int		$max        Maximum number of records to load
72 72
      *  @return	void
73
-	 */
74
-	function loadBox($max=5)
75
-	{
76
-		global $user, $langs, $db, $conf;
77
-		$langs->load("boxes");
78
-
79
-		$this->max=$max;
80
-
81
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts",$max));
82
-
83
-		if ($user->rights->societe->lire && $user->rights->societe->contact->lire)
84
-		{
85
-			$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
86
-			$sql.= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile";
87
-			$sql.= ", s.nom as socname, s.name_alias";
88
-			$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
89
-			$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
90
-			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
91
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
-			$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
93
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
94
-			if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
95
-			$sql.= " ORDER BY sp.tms DESC";
96
-			$sql.= $db->plimit($max, 0);
97
-
98
-			$result = $db->query($sql);
99
-			if ($result) {
100
-				$num = $db->num_rows($result);
101
-
102
-				$contactstatic=new Contact($db);
103
-				$societestatic=new Societe($db);
104
-
105
-				$line = 0;
106
-				while ($line < $num)
107
-				{
108
-					$objp = $db->fetch_object($result);
109
-					$datec=$db->jdate($objp->datec);
110
-					$datem=$db->jdate($objp->tms);
111
-
112
-					$contactstatic->id=$objp->id;
113
-					$contactstatic->lastname=$objp->lastname;
114
-					$contactstatic->firstname=$objp->firstname;
115
-					$contactstatic->civility_id=$objp->civility_id;
116
-					$contactstatic->statut=$objp->status;
117
-					$contactstatic->phone_pro = $objp->phone;
118
-					$contactstatic->phone_perso = $objp->phone_perso;
119
-					$contactstatic->phone_mobile = $objp->phone_mobile;
120
-					$contactstatic->address = $objp->address;
121
-					$contactstatic->zip = $objp->zip;
122
-					$contactstatic->town = $objp->town;
123
-
124
-					$societestatic->id = $objp->fk_soc;
125
-					$societestatic->name = $objp->socname;
126
-					$societestatic->name_alias = $objp->name_alias;
127
-					$societestatic->code_client = $objp->code_client;
128
-					$societestatic->code_fournisseur = $objp->code_fournisseur;
129
-					$societestatic->client = $objp->client;
130
-					$societestatic->fournisseur = $objp->fournisseur;
131
-
132
-					$this->info_box_contents[$line][] = array(
133
-						'td' => '',
134
-						'text' => $contactstatic->getNomUrl(1),
135
-						'asis' => 1,
136
-					);
137
-
138
-					$this->info_box_contents[$line][] = array(
139
-						'td' => '',
140
-						'text' => ($objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : ''),
141
-						'asis' => 1,
142
-					);
143
-
144
-					$this->info_box_contents[$line][] = array(
145
-						'td' => 'class="right"',
146
-						'text' => dol_print_date($datem, "day"),
147
-					);
148
-
149
-					$this->info_box_contents[$line][] = array(
150
-						'td' => 'align="right" class="nowrap" width="18"',
151
-						'text' => $contactstatic->getLibStatut(3),
152
-						'asis'=>1,
153
-					);
154
-
155
-					$line++;
156
-				}
157
-
158
-				if ($num==0)
159
-					$this->info_box_contents[$line][0] = array(
160
-						'td' => 'align="center"',
161
-						'text'=>$langs->trans("NoRecordedContacts"),
162
-					);
163
-
164
-				$db->free($result);
165
-			} else {
166
-				$this->info_box_contents[0][0] = array(
167
-					'td' => '',
168
-					'maxlength'=>500,
169
-					'text' => ($db->error().' sql='.$sql),
170
-				);
171
-			}
172
-		} else {
173
-			$this->info_box_contents[0][0] = array(
174
-				'td' => 'align="left" class="nohover opacitymedium"',
175
-				'text' => $langs->trans("ReadPermissionNotAllowed")
176
-			);
177
-		}
178
-	}
179
-
180
-	/**
181
-	 *	Method to show box
182
-	 *
183
-	 *	@param	array	$head		Array with properties of box title
184
-	 *	@param  array	$contents	Array with properties of box lines
185
-	 *	@param	int	$nooutput	No print, only return string
186
-	 *	@return	string
187
-	 */
188
-	function showBox($head = null, $contents = null, $nooutput=0)
189
-	{
190
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
191
-	}
73
+     */
74
+    function loadBox($max=5)
75
+    {
76
+        global $user, $langs, $db, $conf;
77
+        $langs->load("boxes");
78
+
79
+        $this->max=$max;
80
+
81
+        $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts",$max));
82
+
83
+        if ($user->rights->societe->lire && $user->rights->societe->contact->lire)
84
+        {
85
+            $sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
86
+            $sql.= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile";
87
+            $sql.= ", s.nom as socname, s.name_alias";
88
+            $sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
89
+            $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
90
+            $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
91
+            if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
+            $sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
93
+            if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
94
+            if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
95
+            $sql.= " ORDER BY sp.tms DESC";
96
+            $sql.= $db->plimit($max, 0);
97
+
98
+            $result = $db->query($sql);
99
+            if ($result) {
100
+                $num = $db->num_rows($result);
101
+
102
+                $contactstatic=new Contact($db);
103
+                $societestatic=new Societe($db);
104
+
105
+                $line = 0;
106
+                while ($line < $num)
107
+                {
108
+                    $objp = $db->fetch_object($result);
109
+                    $datec=$db->jdate($objp->datec);
110
+                    $datem=$db->jdate($objp->tms);
111
+
112
+                    $contactstatic->id=$objp->id;
113
+                    $contactstatic->lastname=$objp->lastname;
114
+                    $contactstatic->firstname=$objp->firstname;
115
+                    $contactstatic->civility_id=$objp->civility_id;
116
+                    $contactstatic->statut=$objp->status;
117
+                    $contactstatic->phone_pro = $objp->phone;
118
+                    $contactstatic->phone_perso = $objp->phone_perso;
119
+                    $contactstatic->phone_mobile = $objp->phone_mobile;
120
+                    $contactstatic->address = $objp->address;
121
+                    $contactstatic->zip = $objp->zip;
122
+                    $contactstatic->town = $objp->town;
123
+
124
+                    $societestatic->id = $objp->fk_soc;
125
+                    $societestatic->name = $objp->socname;
126
+                    $societestatic->name_alias = $objp->name_alias;
127
+                    $societestatic->code_client = $objp->code_client;
128
+                    $societestatic->code_fournisseur = $objp->code_fournisseur;
129
+                    $societestatic->client = $objp->client;
130
+                    $societestatic->fournisseur = $objp->fournisseur;
131
+
132
+                    $this->info_box_contents[$line][] = array(
133
+                        'td' => '',
134
+                        'text' => $contactstatic->getNomUrl(1),
135
+                        'asis' => 1,
136
+                    );
137
+
138
+                    $this->info_box_contents[$line][] = array(
139
+                        'td' => '',
140
+                        'text' => ($objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : ''),
141
+                        'asis' => 1,
142
+                    );
143
+
144
+                    $this->info_box_contents[$line][] = array(
145
+                        'td' => 'class="right"',
146
+                        'text' => dol_print_date($datem, "day"),
147
+                    );
148
+
149
+                    $this->info_box_contents[$line][] = array(
150
+                        'td' => 'align="right" class="nowrap" width="18"',
151
+                        'text' => $contactstatic->getLibStatut(3),
152
+                        'asis'=>1,
153
+                    );
154
+
155
+                    $line++;
156
+                }
157
+
158
+                if ($num==0)
159
+                    $this->info_box_contents[$line][0] = array(
160
+                        'td' => 'align="center"',
161
+                        'text'=>$langs->trans("NoRecordedContacts"),
162
+                    );
163
+
164
+                $db->free($result);
165
+            } else {
166
+                $this->info_box_contents[0][0] = array(
167
+                    'td' => '',
168
+                    'maxlength'=>500,
169
+                    'text' => ($db->error().' sql='.$sql),
170
+                );
171
+            }
172
+        } else {
173
+            $this->info_box_contents[0][0] = array(
174
+                'td' => 'align="left" class="nohover opacitymedium"',
175
+                'text' => $langs->trans("ReadPermissionNotAllowed")
176
+            );
177
+        }
178
+    }
179
+
180
+    /**
181
+     *	Method to show box
182
+     *
183
+     *	@param	array	$head		Array with properties of box title
184
+     *	@param  array	$contents	Array with properties of box lines
185
+     *	@param	int	$nooutput	No print, only return string
186
+     *	@return	string
187
+     */
188
+    function showBox($head = null, $contents = null, $nooutput=0)
189
+    {
190
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
191
+    }
192 192
 }
193 193
 
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class box_contacts extends ModeleBoxes
36 36
 {
37
-	var $boxcode="lastcontacts";
38
-	var $boximg="object_contact";
39
-	var $boxlabel="BoxLastContacts";
37
+	var $boxcode = "lastcontacts";
38
+	var $boximg = "object_contact";
39
+	var $boxlabel = "BoxLastContacts";
40 40
 	var $depends = array("societe");
41 41
 
42 42
 	/**
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 *  @param  DoliDB  $db         Database handler
57 57
 	 *  @param  string  $param      More parameters
58 58
 	 */
59
-	function __construct($db,$param)
59
+	function __construct($db, $param)
60 60
 	{
61 61
 	    global $user;
62 62
 
63
-	    $this->db=$db;
63
+	    $this->db = $db;
64 64
 
65
-	    $this->hidden=! ($user->rights->societe->lire && $user->rights->societe->contact->lire);
65
+	    $this->hidden = !($user->rights->societe->lire && $user->rights->societe->contact->lire);
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,49 +71,49 @@  discard block
 block discarded – undo
71 71
 	 *  @param	int		$max        Maximum number of records to load
72 72
      *  @return	void
73 73
 	 */
74
-	function loadBox($max=5)
74
+	function loadBox($max = 5)
75 75
 	{
76 76
 		global $user, $langs, $db, $conf;
77 77
 		$langs->load("boxes");
78 78
 
79
-		$this->max=$max;
79
+		$this->max = $max;
80 80
 
81
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts",$max));
81
+		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts", $max));
82 82
 
83 83
 		if ($user->rights->societe->lire && $user->rights->societe->contact->lire)
84 84
 		{
85 85
 			$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
86
-			$sql.= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile";
87
-			$sql.= ", s.nom as socname, s.name_alias";
88
-			$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
89
-			$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
90
-			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
91
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
-			$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
93
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
94
-			if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
95
-			$sql.= " ORDER BY sp.tms DESC";
96
-			$sql.= $db->plimit($max, 0);
86
+			$sql .= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile";
87
+			$sql .= ", s.nom as socname, s.name_alias";
88
+			$sql .= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
89
+			$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
90
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
91
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
92
+			$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
93
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sp.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
94
+			if ($user->societe_id) $sql .= " AND sp.fk_soc = ".$user->societe_id;
95
+			$sql .= " ORDER BY sp.tms DESC";
96
+			$sql .= $db->plimit($max, 0);
97 97
 
98 98
 			$result = $db->query($sql);
99 99
 			if ($result) {
100 100
 				$num = $db->num_rows($result);
101 101
 
102
-				$contactstatic=new Contact($db);
103
-				$societestatic=new Societe($db);
102
+				$contactstatic = new Contact($db);
103
+				$societestatic = new Societe($db);
104 104
 
105 105
 				$line = 0;
106 106
 				while ($line < $num)
107 107
 				{
108 108
 					$objp = $db->fetch_object($result);
109
-					$datec=$db->jdate($objp->datec);
110
-					$datem=$db->jdate($objp->tms);
111
-
112
-					$contactstatic->id=$objp->id;
113
-					$contactstatic->lastname=$objp->lastname;
114
-					$contactstatic->firstname=$objp->firstname;
115
-					$contactstatic->civility_id=$objp->civility_id;
116
-					$contactstatic->statut=$objp->status;
109
+					$datec = $db->jdate($objp->datec);
110
+					$datem = $db->jdate($objp->tms);
111
+
112
+					$contactstatic->id = $objp->id;
113
+					$contactstatic->lastname = $objp->lastname;
114
+					$contactstatic->firstname = $objp->firstname;
115
+					$contactstatic->civility_id = $objp->civility_id;
116
+					$contactstatic->statut = $objp->status;
117 117
 					$contactstatic->phone_pro = $objp->phone;
118 118
 					$contactstatic->phone_perso = $objp->phone_perso;
119 119
 					$contactstatic->phone_mobile = $objp->phone_mobile;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 					$line++;
156 156
 				}
157 157
 
158
-				if ($num==0)
158
+				if ($num == 0)
159 159
 					$this->info_box_contents[$line][0] = array(
160 160
 						'td' => 'align="center"',
161 161
 						'text'=>$langs->trans("NoRecordedContacts"),
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 *	@param	int	$nooutput	No print, only return string
186 186
 	 *	@return	string
187 187
 	 */
188
-	function showBox($head = null, $contents = null, $nooutput=0)
188
+	function showBox($head = null, $contents = null, $nooutput = 0)
189 189
 	{
190 190
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
191 191
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -88,10 +88,16 @@  discard block
 block discarded – undo
88 88
 			$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
89 89
 			$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
90 90
 			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
91
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
91
+			if (! $user->rights->societe->client->voir && ! $user->societe_id) {
92
+			    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
93
+			}
92 94
 			$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
93
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
94
-			if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
95
+			if (! $user->rights->societe->client->voir && ! $user->societe_id) {
96
+			    $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
97
+			}
98
+			if ($user->societe_id) {
99
+			    $sql.= " AND sp.fk_soc = ".$user->societe_id;
100
+			}
95 101
 			$sql.= " ORDER BY sp.tms DESC";
96 102
 			$sql.= $db->plimit($max, 0);
97 103
 
@@ -155,11 +161,12 @@  discard block
 block discarded – undo
155 161
 					$line++;
156 162
 				}
157 163
 
158
-				if ($num==0)
159
-					$this->info_box_contents[$line][0] = array(
164
+				if ($num==0) {
165
+									$this->info_box_contents[$line][0] = array(
160 166
 						'td' => 'align="center"',
161 167
 						'text'=>$langs->trans("NoRecordedContacts"),
162 168
 					);
169
+				}
163 170
 
164 171
 				$db->free($result);
165 172
 			} else {
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_clients.php 3 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -32,61 +32,61 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class box_clients extends ModeleBoxes
34 34
 {
35
-	var $boxcode="lastcustomers";
36
-	var $boximg="object_company";
37
-	var $boxlabel="BoxLastCustomers";
38
-	var $depends = array("societe");
35
+    var $boxcode="lastcustomers";
36
+    var $boximg="object_company";
37
+    var $boxlabel="BoxLastCustomers";
38
+    var $depends = array("societe");
39 39
 
40
-	/**
40
+    /**
41 41
      * @var DoliDB Database handler.
42 42
      */
43 43
     public $db;
44 44
     
45
-	var $enabled = 1;
45
+    var $enabled = 1;
46 46
 
47
-	var $info_box_head = array();
48
-	var $info_box_contents = array();
47
+    var $info_box_head = array();
48
+    var $info_box_contents = array();
49 49
 
50 50
 
51
-	/**
52
-	 *  Constructor
53
-	 *
54
-	 *  @param  DoliDB	$db      	Database handler
51
+    /**
52
+     *  Constructor
53
+     *
54
+     *  @param  DoliDB	$db      	Database handler
55 55
      *  @param	string	$param		More parameters
56
-	 */
57
-	function __construct($db,$param='')
58
-	{
59
-		global $conf, $user;
56
+     */
57
+    function __construct($db,$param='')
58
+    {
59
+        global $conf, $user;
60 60
 
61
-		$this->db = $db;
61
+        $this->db = $db;
62 62
 
63
-		// disable box for such cases
64
-		if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0;	// disabled by this option
63
+        // disable box for such cases
64
+        if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0;	// disabled by this option
65 65
 
66
-		$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
67
-	}
66
+        $this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
67
+    }
68 68
 
69
-	/**
69
+    /**
70 70
      *  Load data for box to show them later
71 71
      *
72 72
      *  @param	int		$max        Maximum number of records to load
73 73
      *  @return	void
74
-	 */
75
-	function loadBox($max=5)
76
-	{
77
-		global $user, $langs, $db, $conf;
78
-		$langs->load("boxes");
74
+     */
75
+    function loadBox($max=5)
76
+    {
77
+        global $user, $langs, $db, $conf;
78
+        $langs->load("boxes");
79 79
 
80
-		$this->max=$max;
80
+        $this->max=$max;
81 81
 
82 82
         include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
83 83
         $thirdpartystatic=new Societe($db);
84 84
 
85 85
         $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers",$max));
86 86
 
87
-		if ($user->rights->societe->lire)
88
-		{
89
-			$sql = "SELECT s.nom as name, s.rowid as socid";
87
+        if ($user->rights->societe->lire)
88
+        {
89
+            $sql = "SELECT s.nom as name, s.rowid as socid";
90 90
             $sql.= ", s.code_client";
91 91
             $sql.= ", s.client";
92 92
             $sql.= ", s.code_fournisseur";
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
             $sql.= ", s.logo";
97 97
             $sql.= ", s.email";
98 98
             $sql.= ", s.datec, s.tms, s.status";
99
-			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
100
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
101
-			$sql.= " WHERE s.client IN (1, 3)";
102
-			$sql.= " AND s.entity IN (".getEntity('societe').")";
103
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
104
-			if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id";
105
-			$sql.= " ORDER BY s.tms DESC";
106
-			$sql.= $db->plimit($max, 0);
107
-
108
-			dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
109
-			$result = $db->query($sql);
110
-			if ($result)
111
-			{
112
-				$num = $db->num_rows($result);
113
-
114
-				$line = 0;
115
-				while ($line < $num)
116
-				{
117
-					$objp = $db->fetch_object($result);
118
-					$datec=$db->jdate($objp->datec);
119
-					$datem=$db->jdate($objp->tms);
99
+            $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
100
+            if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
101
+            $sql.= " WHERE s.client IN (1, 3)";
102
+            $sql.= " AND s.entity IN (".getEntity('societe').")";
103
+            if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
104
+            if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id";
105
+            $sql.= " ORDER BY s.tms DESC";
106
+            $sql.= $db->plimit($max, 0);
107
+
108
+            dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
109
+            $result = $db->query($sql);
110
+            if ($result)
111
+            {
112
+                $num = $db->num_rows($result);
113
+
114
+                $line = 0;
115
+                while ($line < $num)
116
+                {
117
+                    $objp = $db->fetch_object($result);
118
+                    $datec=$db->jdate($objp->datec);
119
+                    $datem=$db->jdate($objp->tms);
120 120
                     $thirdpartystatic->id = $objp->socid;
121 121
                     $thirdpartystatic->name = $objp->name;
122 122
                     $thirdpartystatic->code_client = $objp->code_client;
@@ -144,38 +144,38 @@  discard block
 block discarded – undo
144 144
                         'text' => $thirdpartystatic->LibStatut($objp->status,3)
145 145
                     );
146 146
 
147
-					$line++;
148
-				}
149
-
150
-				if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
151
-
152
-				$db->free($result);
153
-			}
154
-			else {
155
-				$this->info_box_contents[0][0] = array(	'td' => '',
156
-    	        										'maxlength'=>500,
157
-	            										'text' => ($db->error().' sql='.$sql));
158
-			}
159
-		}
160
-		else {
161
-			$this->info_box_contents[0][0] = array(
162
-			    'td' => 'align="left" class="nohover opacitymedium"',
147
+                    $line++;
148
+                }
149
+
150
+                if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
151
+
152
+                $db->free($result);
153
+            }
154
+            else {
155
+                $this->info_box_contents[0][0] = array(	'td' => '',
156
+                                                        'maxlength'=>500,
157
+                                                        'text' => ($db->error().' sql='.$sql));
158
+            }
159
+        }
160
+        else {
161
+            $this->info_box_contents[0][0] = array(
162
+                'td' => 'align="left" class="nohover opacitymedium"',
163 163
                 'text' => $langs->trans("ReadPermissionNotAllowed")
164
-			);
165
-		}
166
-	}
167
-
168
-	/**
169
-	 *	Method to show box
170
-	 *
171
-	 *	@param	array	$head       Array with properties of box title
172
-	 *	@param  array	$contents   Array with properties of box lines
173
-	 *  @param	int		$nooutput	No print, only return string
174
-	 *	@return	string
175
-	 */
164
+            );
165
+        }
166
+    }
167
+
168
+    /**
169
+     *	Method to show box
170
+     *
171
+     *	@param	array	$head       Array with properties of box title
172
+     *	@param  array	$contents   Array with properties of box lines
173
+     *  @param	int		$nooutput	No print, only return string
174
+     *	@return	string
175
+     */
176 176
     function showBox($head = null, $contents = null, $nooutput=0)
177 177
     {
178
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
179
-	}
178
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
179
+    }
180 180
 }
181 181
 
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class box_clients extends ModeleBoxes
34 34
 {
35
-	var $boxcode="lastcustomers";
36
-	var $boximg="object_company";
37
-	var $boxlabel="BoxLastCustomers";
35
+	var $boxcode = "lastcustomers";
36
+	var $boximg = "object_company";
37
+	var $boxlabel = "BoxLastCustomers";
38 38
 	var $depends = array("societe");
39 39
 
40 40
 	/**
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 	 *  @param  DoliDB	$db      	Database handler
55 55
      *  @param	string	$param		More parameters
56 56
 	 */
57
-	function __construct($db,$param='')
57
+	function __construct($db, $param = '')
58 58
 	{
59 59
 		global $conf, $user;
60 60
 
61 61
 		$this->db = $db;
62 62
 
63 63
 		// disable box for such cases
64
-		if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0;	// disabled by this option
64
+		if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled = 0; // disabled by this option
65 65
 
66
-		$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
66
+		$this->hidden = !($user->rights->societe->lire && empty($user->socid));
67 67
 	}
68 68
 
69 69
 	/**
@@ -72,38 +72,38 @@  discard block
 block discarded – undo
72 72
      *  @param	int		$max        Maximum number of records to load
73 73
      *  @return	void
74 74
 	 */
75
-	function loadBox($max=5)
75
+	function loadBox($max = 5)
76 76
 	{
77 77
 		global $user, $langs, $db, $conf;
78 78
 		$langs->load("boxes");
79 79
 
80
-		$this->max=$max;
80
+		$this->max = $max;
81 81
 
82 82
         include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
83
-        $thirdpartystatic=new Societe($db);
83
+        $thirdpartystatic = new Societe($db);
84 84
 
85
-        $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers",$max));
85
+        $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max));
86 86
 
87 87
 		if ($user->rights->societe->lire)
88 88
 		{
89 89
 			$sql = "SELECT s.nom as name, s.rowid as socid";
90
-            $sql.= ", s.code_client";
91
-            $sql.= ", s.client";
92
-            $sql.= ", s.code_fournisseur";
93
-            $sql.= ", s.fournisseur";
94
-            $sql.= ", s.code_compta";
95
-            $sql.= ", s.code_compta_fournisseur";
96
-            $sql.= ", s.logo";
97
-            $sql.= ", s.email";
98
-            $sql.= ", s.datec, s.tms, s.status";
99
-			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
100
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
101
-			$sql.= " WHERE s.client IN (1, 3)";
102
-			$sql.= " AND s.entity IN (".getEntity('societe').")";
103
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
104
-			if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id";
105
-			$sql.= " ORDER BY s.tms DESC";
106
-			$sql.= $db->plimit($max, 0);
90
+            $sql .= ", s.code_client";
91
+            $sql .= ", s.client";
92
+            $sql .= ", s.code_fournisseur";
93
+            $sql .= ", s.fournisseur";
94
+            $sql .= ", s.code_compta";
95
+            $sql .= ", s.code_compta_fournisseur";
96
+            $sql .= ", s.logo";
97
+            $sql .= ", s.email";
98
+            $sql .= ", s.datec, s.tms, s.status";
99
+			$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
100
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
101
+			$sql .= " WHERE s.client IN (1, 3)";
102
+			$sql .= " AND s.entity IN (".getEntity('societe').")";
103
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
104
+			if ($user->societe_id) $sql .= " AND s.rowid = $user->societe_id";
105
+			$sql .= " ORDER BY s.tms DESC";
106
+			$sql .= $db->plimit($max, 0);
107 107
 
108 108
 			dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
109 109
 			$result = $db->query($sql);
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 				while ($line < $num)
116 116
 				{
117 117
 					$objp = $db->fetch_object($result);
118
-					$datec=$db->jdate($objp->datec);
119
-					$datem=$db->jdate($objp->tms);
118
+					$datec = $db->jdate($objp->datec);
119
+					$datem = $db->jdate($objp->tms);
120 120
                     $thirdpartystatic->id = $objp->socid;
121 121
                     $thirdpartystatic->name = $objp->name;
122 122
                     $thirdpartystatic->code_client = $objp->code_client;
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
 
142 142
                     $this->info_box_contents[$line][] = array(
143 143
                         'td' => 'align="right" width="18"',
144
-                        'text' => $thirdpartystatic->LibStatut($objp->status,3)
144
+                        'text' => $thirdpartystatic->LibStatut($objp->status, 3)
145 145
                     );
146 146
 
147 147
 					$line++;
148 148
 				}
149 149
 
150
-				if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
150
+				if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text'=>$langs->trans("NoRecordedCustomers"));
151 151
 
152 152
 				$db->free($result);
153 153
 			}
154 154
 			else {
155
-				$this->info_box_contents[0][0] = array(	'td' => '',
155
+				$this->info_box_contents[0][0] = array('td' => '',
156 156
     	        										'maxlength'=>500,
157 157
 	            										'text' => ($db->error().' sql='.$sql));
158 158
 			}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 *  @param	int		$nooutput	No print, only return string
174 174
 	 *	@return	string
175 175
 	 */
176
-    function showBox($head = null, $contents = null, $nooutput=0)
176
+    function showBox($head = null, $contents = null, $nooutput = 0)
177 177
     {
178 178
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
179 179
 	}
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,7 +61,10 @@  discard block
 block discarded – undo
61 61
 		$this->db = $db;
62 62
 
63 63
 		// disable box for such cases
64
-		if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0;	// disabled by this option
64
+		if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
65
+		    $this->enabled=0;
66
+		}
67
+		// disabled by this option
65 68
 
66 69
 		$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
67 70
 	}
@@ -97,11 +100,17 @@  discard block
 block discarded – undo
97 100
             $sql.= ", s.email";
98 101
             $sql.= ", s.datec, s.tms, s.status";
99 102
 			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
100
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
103
+			if (!$user->rights->societe->client->voir && !$user->societe_id) {
104
+			    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
105
+			}
101 106
 			$sql.= " WHERE s.client IN (1, 3)";
102 107
 			$sql.= " AND s.entity IN (".getEntity('societe').")";
103
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
104
-			if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id";
108
+			if (!$user->rights->societe->client->voir && !$user->societe_id) {
109
+			    $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
110
+			}
111
+			if ($user->societe_id) {
112
+			    $sql.= " AND s.rowid = $user->societe_id";
113
+			}
105 114
 			$sql.= " ORDER BY s.tms DESC";
106 115
 			$sql.= $db->plimit($max, 0);
107 116
 
@@ -147,17 +156,17 @@  discard block
 block discarded – undo
147 156
 					$line++;
148 157
 				}
149 158
 
150
-				if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
159
+				if ($num==0) {
160
+				    $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
161
+				}
151 162
 
152 163
 				$db->free($result);
153
-			}
154
-			else {
164
+			} else {
155 165
 				$this->info_box_contents[0][0] = array(	'td' => '',
156 166
     	        										'maxlength'=>500,
157 167
 	            										'text' => ($db->error().' sql='.$sql));
158 168
 			}
159
-		}
160
-		else {
169
+		} else {
161 170
 			$this->info_box_contents[0][0] = array(
162 171
 			    'td' => 'align="left" class="nohover opacitymedium"',
163 172
                 'text' => $langs->trans("ReadPermissionNotAllowed")
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_actions.php 3 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -32,88 +32,88 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class box_actions extends ModeleBoxes
34 34
 {
35
-	var $boxcode="lastactions";
36
-	var $boximg="object_action";
37
-	var $boxlabel="BoxLastActions";
38
-	var $depends = array("agenda");
35
+    var $boxcode="lastactions";
36
+    var $boximg="object_action";
37
+    var $boxlabel="BoxLastActions";
38
+    var $depends = array("agenda");
39 39
 
40
-	/**
40
+    /**
41 41
      * @var DoliDB Database handler.
42 42
      */
43 43
     public $db;
44 44
     
45
-	var $param;
45
+    var $param;
46 46
 
47
-	var $info_box_head = array();
48
-	var $info_box_contents = array();
47
+    var $info_box_head = array();
48
+    var $info_box_contents = array();
49 49
 
50 50
 
51
-	/**
52
-	 *  Constructor
53
-	 *
54
-	 *  @param  DoliDB	$db      	Database handler
55
-	 *  @param	string	$param		More parameters
56
-	 */
57
-	function __construct($db,$param='')
58
-	{
59
-	    global $user;
51
+    /**
52
+     *  Constructor
53
+     *
54
+     *  @param  DoliDB	$db      	Database handler
55
+     *  @param	string	$param		More parameters
56
+     */
57
+    function __construct($db,$param='')
58
+    {
59
+        global $user;
60 60
 
61
-	    $this->db = $db;
61
+        $this->db = $db;
62 62
 
63
-	    $this->hidden = ! ($user->rights->agenda->myactions->read);
64
-	}
63
+        $this->hidden = ! ($user->rights->agenda->myactions->read);
64
+    }
65 65
 
66
-	/**
66
+    /**
67 67
      *  Load data for box to show them later
68 68
      *
69 69
      *  @param	int		$max        Maximum number of records to load
70 70
      *  @return	void
71
-	 */
72
-	function loadBox($max=5)
73
-	{
74
-		global $user, $langs, $db, $conf;
71
+     */
72
+    function loadBox($max=5)
73
+    {
74
+        global $user, $langs, $db, $conf;
75 75
 
76
-		$this->max=$max;
76
+        $this->max=$max;
77 77
 
78 78
         include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
79 79
         include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
80 80
         $societestatic = new Societe($db);
81 81
         $actionstatic = new ActionComm($db);
82 82
 
83
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max));
83
+        $this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max));
84 84
 
85 85
         if ($user->rights->agenda->myactions->read) {
86
-			$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
86
+            $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
87 87
             $sql.= ", ta.code";
88 88
             $sql.= ", ta.libelle as type_label";
89 89
             $sql.= ", s.nom as name";
90 90
             $sql.= ", s.rowid as socid";
91 91
             $sql.= ", s.code_client";
92
-			$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
93
-			$sql.= MAIN_DB_PREFIX."actioncomm AS a)";
94
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
95
-			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
96
-			$sql.= " WHERE a.fk_action = ta.id";
97
-			$sql.= " AND a.entity = ".$conf->entity;
98
-			$sql.= " AND a.percent >= 0 AND a.percent < 100";
99
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
100
-			if($user->societe_id)   $sql.= " AND s.rowid = ".$user->societe_id;
101
-			if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
102
-			$sql.= " ORDER BY a.datec DESC";
103
-			$sql.= $db->plimit($max, 0);
104
-
105
-			dol_syslog("Box_actions::loadBox", LOG_DEBUG);
106
-			$result = $db->query($sql);
92
+            $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
93
+            $sql.= MAIN_DB_PREFIX."actioncomm AS a)";
94
+            if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
95
+            $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
96
+            $sql.= " WHERE a.fk_action = ta.id";
97
+            $sql.= " AND a.entity = ".$conf->entity;
98
+            $sql.= " AND a.percent >= 0 AND a.percent < 100";
99
+            if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
100
+            if($user->societe_id)   $sql.= " AND s.rowid = ".$user->societe_id;
101
+            if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
102
+            $sql.= " ORDER BY a.datec DESC";
103
+            $sql.= $db->plimit($max, 0);
104
+
105
+            dol_syslog("Box_actions::loadBox", LOG_DEBUG);
106
+            $result = $db->query($sql);
107 107
             if ($result) {
108
-				$now=dol_now();
109
-				$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
108
+                $now=dol_now();
109
+                $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
110 110
 
111
-				$num = $db->num_rows($result);
112
-				$line = 0;
111
+                $num = $db->num_rows($result);
112
+                $line = 0;
113 113
                 while ($line < $num) {
114
-					$late = '';
115
-					$objp = $db->fetch_object($result);
116
-					$datelimite = $db->jdate($objp->dp);
114
+                    $late = '';
115
+                    $objp = $db->fetch_object($result);
116
+                    $datelimite = $db->jdate($objp->dp);
117 117
                     $actionstatic->id = $objp->id;
118 118
                     $actionstatic->label = $objp->label;
119 119
                     $actionstatic->type_label = $objp->type_label;
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
                     if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite  < ($now - $delay_warning))
126 126
                         $late=img_warning($langs->trans("Late"));
127 127
 
128
-					//($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
129
-					$label = empty($objp->label)?$objp->type_label:$objp->label;
128
+                    //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
129
+                    $label = empty($objp->label)?$objp->type_label:$objp->label;
130 130
 
131 131
                     $this->info_box_contents[$line][] = array(
132 132
                         'td' => '',
@@ -178,86 +178,86 @@  discard block
 block discarded – undo
178 178
                 'td' => 'align="left" class="nohover opacitymedium"',
179 179
                 'text' => $langs->trans("ReadPermissionNotAllowed")
180 180
             );
181
-		}
182
-	}
183
-
184
-	/**
185
-	 *	Method to show box
186
-	 *
187
-	 *	@param	array	$head       Array with properties of box title
188
-	 *	@param  array	$contents   Array with properties of box lines
189
-	 *  @param	int		$nooutput	No print, only return string
190
-	 *	@return	string
191
-	 */
181
+        }
182
+    }
183
+
184
+    /**
185
+     *	Method to show box
186
+     *
187
+     *	@param	array	$head       Array with properties of box title
188
+     *	@param  array	$contents   Array with properties of box lines
189
+     *  @param	int		$nooutput	No print, only return string
190
+     *	@return	string
191
+     */
192 192
     function showBox($head = null, $contents = null, $nooutput=0)
193 193
     {
194
-		global $langs, $conf;
195
-		$out = parent::showBox($this->info_box_head, $this->info_box_contents);
194
+        global $langs, $conf;
195
+        $out = parent::showBox($this->info_box_head, $this->info_box_contents);
196 196
 
197 197
         if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
198 198
         {
199
-			$actioncejour=false;
200
-			$contents=$this->info_box_contents;
201
-			$nblines=count($contents);
202
-			if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
203
-			{
204
-				$out.= '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
205
-				$out.= '<table width=100%>';
206
-				for ($line=0, $n=$nblines; $line < $n; $line++)
207
-				{
208
-					if (isset($contents[$line]))
209
-					{
210
-						// on affiche que les évènement du jours ou passé
211
-						// qui ne sont pas à 100%
212
-						$actioncejour=true;
213
-
214
-						// TR
215
-						$logo=$contents[$line][0]['logo'];
216
-						$label=$contents[$line][1]['text'];
217
-						$urlevent=$contents[$line][1]['url'];
218
-						$logosoc=$contents[$line][2]['logo'];
219
-						$nomsoc=$contents[$line][3]['text'];
220
-						$urlsoc=$contents[$line][3]['url'];
221
-						$dateligne=$contents[$line][4]['text'];
222
-						$percentage=$contents[$line][5]['text'];
223
-						$out.= '<tr class="oddeven">';
224
-						$out.= '<td align=center>';
225
-						$out.= img_object("",$logo);
226
-						$out.= '</td>';
227
-						$out.= '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>';
228
-						$out.= '<td align=center><a href="'.$urlsoc.'">'.img_object("",$logosoc)." ".$nomsoc.'</a></td>';
229
-						$out.= '<td align=center>'.$dateligne.'</td>';
230
-						$out.= '<td align=center>'.$percentage.'</td>';
231
-						$out.= '</tr>';
232
-					}
233
-				}
234
-				$out.= '</table>';
235
-			}
236
-			$out.= '</div>';
237
-			if ($actioncejour)
238
-			{
239
-				$out.= '<script>';
240
-				$out.= '$("#dialogboxaction").dialog({ autoOpen: true });';
241
-				if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1)    // autoclose after this delay
242
-				{
243
-					$out.= 'setTimeout(function(){';
244
-					$out.= '$("#dialogboxaction").dialog("close");';
245
-					$out.= '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');';
246
-				}
247
-				$out.= '</script>';
248
-			}
249
-			else
250
-			{
251
-				$out.= '<script>';
252
-				$out.= '$("#dialogboxaction").dialog({ autoOpen: false });';
253
-				$out.= '</script>';
254
-			}
255
-		}
256
-
257
-		if ($nooutput) return $out;
258
-		else print $out;
259
-
260
-		return '';
261
-	}
199
+            $actioncejour=false;
200
+            $contents=$this->info_box_contents;
201
+            $nblines=count($contents);
202
+            if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
203
+            {
204
+                $out.= '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
205
+                $out.= '<table width=100%>';
206
+                for ($line=0, $n=$nblines; $line < $n; $line++)
207
+                {
208
+                    if (isset($contents[$line]))
209
+                    {
210
+                        // on affiche que les évènement du jours ou passé
211
+                        // qui ne sont pas à 100%
212
+                        $actioncejour=true;
213
+
214
+                        // TR
215
+                        $logo=$contents[$line][0]['logo'];
216
+                        $label=$contents[$line][1]['text'];
217
+                        $urlevent=$contents[$line][1]['url'];
218
+                        $logosoc=$contents[$line][2]['logo'];
219
+                        $nomsoc=$contents[$line][3]['text'];
220
+                        $urlsoc=$contents[$line][3]['url'];
221
+                        $dateligne=$contents[$line][4]['text'];
222
+                        $percentage=$contents[$line][5]['text'];
223
+                        $out.= '<tr class="oddeven">';
224
+                        $out.= '<td align=center>';
225
+                        $out.= img_object("",$logo);
226
+                        $out.= '</td>';
227
+                        $out.= '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>';
228
+                        $out.= '<td align=center><a href="'.$urlsoc.'">'.img_object("",$logosoc)." ".$nomsoc.'</a></td>';
229
+                        $out.= '<td align=center>'.$dateligne.'</td>';
230
+                        $out.= '<td align=center>'.$percentage.'</td>';
231
+                        $out.= '</tr>';
232
+                    }
233
+                }
234
+                $out.= '</table>';
235
+            }
236
+            $out.= '</div>';
237
+            if ($actioncejour)
238
+            {
239
+                $out.= '<script>';
240
+                $out.= '$("#dialogboxaction").dialog({ autoOpen: true });';
241
+                if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1)    // autoclose after this delay
242
+                {
243
+                    $out.= 'setTimeout(function(){';
244
+                    $out.= '$("#dialogboxaction").dialog("close");';
245
+                    $out.= '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');';
246
+                }
247
+                $out.= '</script>';
248
+            }
249
+            else
250
+            {
251
+                $out.= '<script>';
252
+                $out.= '$("#dialogboxaction").dialog({ autoOpen: false });';
253
+                $out.= '</script>';
254
+            }
255
+        }
256
+
257
+        if ($nooutput) return $out;
258
+        else print $out;
259
+
260
+        return '';
261
+    }
262 262
 }
263 263
 
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class box_actions extends ModeleBoxes
34 34
 {
35
-	var $boxcode="lastactions";
36
-	var $boximg="object_action";
37
-	var $boxlabel="BoxLastActions";
35
+	var $boxcode = "lastactions";
36
+	var $boximg = "object_action";
37
+	var $boxlabel = "BoxLastActions";
38 38
 	var $depends = array("agenda");
39 39
 
40 40
 	/**
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 	 *  @param  DoliDB	$db      	Database handler
55 55
 	 *  @param	string	$param		More parameters
56 56
 	 */
57
-	function __construct($db,$param='')
57
+	function __construct($db, $param = '')
58 58
 	{
59 59
 	    global $user;
60 60
 
61 61
 	    $this->db = $db;
62 62
 
63
-	    $this->hidden = ! ($user->rights->agenda->myactions->read);
63
+	    $this->hidden = !($user->rights->agenda->myactions->read);
64 64
 	}
65 65
 
66 66
 	/**
@@ -69,44 +69,44 @@  discard block
 block discarded – undo
69 69
      *  @param	int		$max        Maximum number of records to load
70 70
      *  @return	void
71 71
 	 */
72
-	function loadBox($max=5)
72
+	function loadBox($max = 5)
73 73
 	{
74 74
 		global $user, $langs, $db, $conf;
75 75
 
76
-		$this->max=$max;
76
+		$this->max = $max;
77 77
 
78 78
         include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
79 79
         include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
80 80
         $societestatic = new Societe($db);
81 81
         $actionstatic = new ActionComm($db);
82 82
 
83
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max));
83
+		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo", $max));
84 84
 
85 85
         if ($user->rights->agenda->myactions->read) {
86 86
 			$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
87
-            $sql.= ", ta.code";
88
-            $sql.= ", ta.libelle as type_label";
89
-            $sql.= ", s.nom as name";
90
-            $sql.= ", s.rowid as socid";
91
-            $sql.= ", s.code_client";
92
-			$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
93
-			$sql.= MAIN_DB_PREFIX."actioncomm AS a)";
94
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
95
-			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
96
-			$sql.= " WHERE a.fk_action = ta.id";
97
-			$sql.= " AND a.entity = ".$conf->entity;
98
-			$sql.= " AND a.percent >= 0 AND a.percent < 100";
99
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
100
-			if($user->societe_id)   $sql.= " AND s.rowid = ".$user->societe_id;
101
-			if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
102
-			$sql.= " ORDER BY a.datec DESC";
103
-			$sql.= $db->plimit($max, 0);
87
+            $sql .= ", ta.code";
88
+            $sql .= ", ta.libelle as type_label";
89
+            $sql .= ", s.nom as name";
90
+            $sql .= ", s.rowid as socid";
91
+            $sql .= ", s.code_client";
92
+			$sql .= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
93
+			$sql .= MAIN_DB_PREFIX."actioncomm AS a)";
94
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
95
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
96
+			$sql .= " WHERE a.fk_action = ta.id";
97
+			$sql .= " AND a.entity = ".$conf->entity;
98
+			$sql .= " AND a.percent >= 0 AND a.percent < 100";
99
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")";
100
+			if ($user->societe_id)   $sql .= " AND s.rowid = ".$user->societe_id;
101
+			if (!$user->rights->agenda->allactions->read) $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")";
102
+			$sql .= " ORDER BY a.datec DESC";
103
+			$sql .= $db->plimit($max, 0);
104 104
 
105 105
 			dol_syslog("Box_actions::loadBox", LOG_DEBUG);
106 106
 			$result = $db->query($sql);
107 107
             if ($result) {
108
-				$now=dol_now();
109
-				$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
108
+				$now = dol_now();
109
+				$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
110 110
 
111 111
 				$num = $db->num_rows($result);
112 112
 				$line = 0;
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
                     $societestatic->name = $objp->name;
123 123
                     $societestatic->code_client = $objp->code_client;
124 124
 
125
-                    if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite  < ($now - $delay_warning))
126
-                        $late=img_warning($langs->trans("Late"));
125
+                    if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning))
126
+                        $late = img_warning($langs->trans("Late"));
127 127
 
128 128
 					//($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
129
-					$label = empty($objp->label)?$objp->type_label:$objp->label;
129
+					$label = empty($objp->label) ? $objp->type_label : $objp->label;
130 130
 
131 131
                     $this->info_box_contents[$line][] = array(
132 132
                         'td' => '',
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
 
149 149
                     $this->info_box_contents[$line][] = array(
150 150
                         'td' => 'class="right"',
151
-                        'text' => ($objp->percentage>= 0?$objp->percentage.'%':''),
151
+                        'text' => ($objp->percentage >= 0 ? $objp->percentage.'%' : ''),
152 152
                     );
153 153
 
154 154
                     $this->info_box_contents[$line][] = array(
155 155
                         'td' => 'align="right" width="18"',
156
-                        'text' => $actionstatic->LibStatut($objp->percentage,3),
156
+                        'text' => $actionstatic->LibStatut($objp->percentage, 3),
157 157
                     );
158 158
 
159 159
                     $line++;
160 160
                 }
161 161
 
162
-                if ($num==0)
162
+                if ($num == 0)
163 163
                     $this->info_box_contents[$line][0] = array(
164 164
                         'td' => 'align="center"',
165 165
                         'text'=>$langs->trans("NoActionsToDo"),
@@ -189,68 +189,68 @@  discard block
 block discarded – undo
189 189
 	 *  @param	int		$nooutput	No print, only return string
190 190
 	 *	@return	string
191 191
 	 */
192
-    function showBox($head = null, $contents = null, $nooutput=0)
192
+    function showBox($head = null, $contents = null, $nooutput = 0)
193 193
     {
194 194
 		global $langs, $conf;
195 195
 		$out = parent::showBox($this->info_box_head, $this->info_box_contents);
196 196
 
197
-        if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
197
+        if (!empty($conf->global->SHOW_DIALOG_HOMEPAGE))
198 198
         {
199
-			$actioncejour=false;
200
-			$contents=$this->info_box_contents;
201
-			$nblines=count($contents);
199
+			$actioncejour = false;
200
+			$contents = $this->info_box_contents;
201
+			$nblines = count($contents);
202 202
 			if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
203 203
 			{
204
-				$out.= '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
205
-				$out.= '<table width=100%>';
206
-				for ($line=0, $n=$nblines; $line < $n; $line++)
204
+				$out .= '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
205
+				$out .= '<table width=100%>';
206
+				for ($line = 0, $n = $nblines; $line < $n; $line++)
207 207
 				{
208 208
 					if (isset($contents[$line]))
209 209
 					{
210 210
 						// on affiche que les évènement du jours ou passé
211 211
 						// qui ne sont pas à 100%
212
-						$actioncejour=true;
212
+						$actioncejour = true;
213 213
 
214 214
 						// TR
215
-						$logo=$contents[$line][0]['logo'];
216
-						$label=$contents[$line][1]['text'];
217
-						$urlevent=$contents[$line][1]['url'];
218
-						$logosoc=$contents[$line][2]['logo'];
219
-						$nomsoc=$contents[$line][3]['text'];
220
-						$urlsoc=$contents[$line][3]['url'];
221
-						$dateligne=$contents[$line][4]['text'];
222
-						$percentage=$contents[$line][5]['text'];
223
-						$out.= '<tr class="oddeven">';
224
-						$out.= '<td align=center>';
225
-						$out.= img_object("",$logo);
226
-						$out.= '</td>';
227
-						$out.= '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>';
228
-						$out.= '<td align=center><a href="'.$urlsoc.'">'.img_object("",$logosoc)." ".$nomsoc.'</a></td>';
229
-						$out.= '<td align=center>'.$dateligne.'</td>';
230
-						$out.= '<td align=center>'.$percentage.'</td>';
231
-						$out.= '</tr>';
215
+						$logo = $contents[$line][0]['logo'];
216
+						$label = $contents[$line][1]['text'];
217
+						$urlevent = $contents[$line][1]['url'];
218
+						$logosoc = $contents[$line][2]['logo'];
219
+						$nomsoc = $contents[$line][3]['text'];
220
+						$urlsoc = $contents[$line][3]['url'];
221
+						$dateligne = $contents[$line][4]['text'];
222
+						$percentage = $contents[$line][5]['text'];
223
+						$out .= '<tr class="oddeven">';
224
+						$out .= '<td align=center>';
225
+						$out .= img_object("", $logo);
226
+						$out .= '</td>';
227
+						$out .= '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>';
228
+						$out .= '<td align=center><a href="'.$urlsoc.'">'.img_object("", $logosoc)." ".$nomsoc.'</a></td>';
229
+						$out .= '<td align=center>'.$dateligne.'</td>';
230
+						$out .= '<td align=center>'.$percentage.'</td>';
231
+						$out .= '</tr>';
232 232
 					}
233 233
 				}
234
-				$out.= '</table>';
234
+				$out .= '</table>';
235 235
 			}
236
-			$out.= '</div>';
236
+			$out .= '</div>';
237 237
 			if ($actioncejour)
238 238
 			{
239
-				$out.= '<script>';
240
-				$out.= '$("#dialogboxaction").dialog({ autoOpen: true });';
239
+				$out .= '<script>';
240
+				$out .= '$("#dialogboxaction").dialog({ autoOpen: true });';
241 241
 				if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1)    // autoclose after this delay
242 242
 				{
243
-					$out.= 'setTimeout(function(){';
244
-					$out.= '$("#dialogboxaction").dialog("close");';
245
-					$out.= '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');';
243
+					$out .= 'setTimeout(function(){';
244
+					$out .= '$("#dialogboxaction").dialog("close");';
245
+					$out .= '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE * 1000).');';
246 246
 				}
247
-				$out.= '</script>';
247
+				$out .= '</script>';
248 248
 			}
249 249
 			else
250 250
 			{
251
-				$out.= '<script>';
252
-				$out.= '$("#dialogboxaction").dialog({ autoOpen: false });';
253
-				$out.= '</script>';
251
+				$out .= '<script>';
252
+				$out .= '$("#dialogboxaction").dialog({ autoOpen: false });';
253
+				$out .= '</script>';
254 254
 			}
255 255
 		}
256 256
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -91,14 +91,22 @@  discard block
 block discarded – undo
91 91
             $sql.= ", s.code_client";
92 92
 			$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
93 93
 			$sql.= MAIN_DB_PREFIX."actioncomm AS a)";
94
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
94
+			if (! $user->rights->societe->client->voir && ! $user->societe_id) {
95
+			    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
96
+			}
95 97
 			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
96 98
 			$sql.= " WHERE a.fk_action = ta.id";
97 99
 			$sql.= " AND a.entity = ".$conf->entity;
98 100
 			$sql.= " AND a.percent >= 0 AND a.percent < 100";
99
-			if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
100
-			if($user->societe_id)   $sql.= " AND s.rowid = ".$user->societe_id;
101
-			if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
101
+			if (! $user->rights->societe->client->voir && ! $user->societe_id) {
102
+			    $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
103
+			}
104
+			if($user->societe_id) {
105
+			    $sql.= " AND s.rowid = ".$user->societe_id;
106
+			}
107
+			if (! $user->rights->agenda->allactions->read) {
108
+			    $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
109
+			}
102 110
 			$sql.= " ORDER BY a.datec DESC";
103 111
 			$sql.= $db->plimit($max, 0);
104 112
 
@@ -122,8 +130,9 @@  discard block
 block discarded – undo
122 130
                     $societestatic->name = $objp->name;
123 131
                     $societestatic->code_client = $objp->code_client;
124 132
 
125
-                    if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite  < ($now - $delay_warning))
126
-                        $late=img_warning($langs->trans("Late"));
133
+                    if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite  < ($now - $delay_warning)) {
134
+                                            $late=img_warning($langs->trans("Late"));
135
+                    }
127 136
 
128 137
 					//($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
129 138
 					$label = empty($objp->label)?$objp->type_label:$objp->label;
@@ -159,11 +168,12 @@  discard block
 block discarded – undo
159 168
                     $line++;
160 169
                 }
161 170
 
162
-                if ($num==0)
163
-                    $this->info_box_contents[$line][0] = array(
171
+                if ($num==0) {
172
+                                    $this->info_box_contents[$line][0] = array(
164 173
                         'td' => 'align="center"',
165 174
                         'text'=>$langs->trans("NoActionsToDo"),
166 175
                     );
176
+                }
167 177
 
168 178
                 $db->free($result);
169 179
             } else {
@@ -238,15 +248,16 @@  discard block
 block discarded – undo
238 248
 			{
239 249
 				$out.= '<script>';
240 250
 				$out.= '$("#dialogboxaction").dialog({ autoOpen: true });';
241
-				if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1)    // autoclose after this delay
251
+				if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1) {
252
+				    // autoclose after this delay
242 253
 				{
243 254
 					$out.= 'setTimeout(function(){';
255
+				}
244 256
 					$out.= '$("#dialogboxaction").dialog("close");';
245 257
 					$out.= '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');';
246 258
 				}
247 259
 				$out.= '</script>';
248
-			}
249
-			else
260
+			} else
250 261
 			{
251 262
 				$out.= '<script>';
252 263
 				$out.= '$("#dialogboxaction").dialog({ autoOpen: false });';
@@ -254,8 +265,11 @@  discard block
 block discarded – undo
254 265
 			}
255 266
 		}
256 267
 
257
-		if ($nooutput) return $out;
258
-		else print $out;
268
+		if ($nooutput) {
269
+		    return $out;
270
+		} else {
271
+		    print $out;
272
+		}
259 273
 
260 274
 		return '';
261 275
 	}
Please login to merge, or discard this patch.