Passed
Push — master ( 222e44...208bd5 )
by Alxarafe
31:22
created
dolibarr/htdocs/core/boxes/box_comptes.php 3 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -33,71 +33,71 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class box_comptes extends ModeleBoxes
35 35
 {
36
-	var $boxcode="currentaccounts";
37
-	var $boximg="object_bill";
38
-	var $boxlabel="BoxCurrentAccounts";
39
-	var $depends = array("banque");     // Box active if module banque active
36
+    var $boxcode="currentaccounts";
37
+    var $boximg="object_bill";
38
+    var $boxlabel="BoxCurrentAccounts";
39
+    var $depends = array("banque");     // Box active if module banque active
40 40
 
41
-	/**
41
+    /**
42 42
      * @var DoliDB Database handler.
43 43
      */
44 44
     public $db;
45 45
     
46
-	var $param;
47
-	var $enabled = 1;
46
+    var $param;
47
+    var $enabled = 1;
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
53
+    /**
54
+     *  Constructor
55
+     *
56
+     *  @param  DoliDB	$db      	Database handler
57 57
      *  @param	string	$param		More parameters
58
-	 */
59
-	function __construct($db,$param='')
60
-	{
61
-		global $conf, $user;
58
+     */
59
+    function __construct($db,$param='')
60
+    {
61
+        global $conf, $user;
62 62
 
63
-		$this->db = $db;
63
+        $this->db = $db;
64 64
 
65
-		// disable module for such cases
66
-		$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
67
-		if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
65
+        // disable module for such cases
66
+        $listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
67
+        if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
68 68
 
69
-		$this->hidden = ! ($user->rights->banque->lire);
70
-	}
69
+        $this->hidden = ! ($user->rights->banque->lire);
70
+    }
71 71
 
72
-	/**
73
-	 *  Load data into info_box_contents array to show array later.
74
-	 *
75
-	 *  @param	int		$max        Maximum number of records to load
72
+    /**
73
+     *  Load data into info_box_contents array to show array later.
74
+     *
75
+     *  @param	int		$max        Maximum number of records to load
76 76
      *  @return	void
77
-	 */
78
-	function loadBox($max=5)
79
-	{
80
-		global $user, $langs, $db, $conf;
77
+     */
78
+    function loadBox($max=5)
79
+    {
80
+        global $user, $langs, $db, $conf;
81 81
 
82
-		$this->max=$max;
82
+        $this->max=$max;
83 83
 
84
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
84
+        $this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
85 85
 
86 86
         if ($user->rights->banque->lire) {
87
-			$sql = "SELECT b.rowid, b.ref, b.label, b.bank,b.number, b.courant, b.clos, b.rappro, b.url";
88
-			$sql.= ", b.code_banque, b.code_guichet, b.cle_rib, b.bic, b.iban_prefix as iban";
89
-			$sql.= ", b.domiciliation, b.proprio, b.owner_address";
90
-			$sql.= ", b.account_number, b.currency_code";
91
-			$sql.= ", b.min_allowed, b.min_desired, comment";
87
+            $sql = "SELECT b.rowid, b.ref, b.label, b.bank,b.number, b.courant, b.clos, b.rappro, b.url";
88
+            $sql.= ", b.code_banque, b.code_guichet, b.cle_rib, b.bic, b.iban_prefix as iban";
89
+            $sql.= ", b.domiciliation, b.proprio, b.owner_address";
90
+            $sql.= ", b.account_number, b.currency_code";
91
+            $sql.= ", b.min_allowed, b.min_desired, comment";
92 92
             $sql.= ', b.fk_accountancy_journal';
93 93
             $sql.= ', aj.code as accountancy_journal';
94 94
             $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
95 95
             $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_journal as aj ON aj.rowid=b.fk_accountancy_journal';
96 96
             $sql.= " WHERE b.entity = ".$conf->entity;
97
-			$sql.= " AND clos = 0";
98
-			//$sql.= " AND courant = 1";
99
-			$sql.= " ORDER BY label";
100
-			$sql.= $db->plimit($max, 0);
97
+            $sql.= " AND clos = 0";
98
+            //$sql.= " AND courant = 1";
99
+            $sql.= " ORDER BY label";
100
+            $sql.= $db->plimit($max, 0);
101 101
 
102 102
             dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
103 103
             $result = $db->query($sql);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     $objp = $db->fetch_object($result);
113 113
 
114 114
                     $account_static->id = $objp->rowid;
115
-					$account_static->ref = $objp->ref;
115
+                    $account_static->ref = $objp->ref;
116 116
                     $account_static->label = $objp->label;
117 117
                     $account_static->number = $objp->number;
118 118
                     $account_static->account_number = $objp->account_number;
@@ -174,19 +174,19 @@  discard block
 block discarded – undo
174 174
                 'text' => $langs->trans("ReadPermissionNotAllowed")
175 175
             );
176 176
         }
177
-	}
178
-
179
-	/**
180
-	 *	Method to show box
181
-	 *
182
-	 *	@param	array	$head       Array with properties of box title
183
-	 *	@param  array	$contents   Array with properties of box lines
184
-	 *  @param	int		$nooutput	No print, only return string
185
-	 *	@return	string
186
-	 */
177
+    }
178
+
179
+    /**
180
+     *	Method to show box
181
+     *
182
+     *	@param	array	$head       Array with properties of box title
183
+     *	@param  array	$contents   Array with properties of box lines
184
+     *  @param	int		$nooutput	No print, only return string
185
+     *	@return	string
186
+     */
187 187
     function showBox($head = null, $contents = null, $nooutput=0)
188 188
     {
189
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
190
-	}
189
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
190
+    }
191 191
 }
192 192
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class box_comptes extends ModeleBoxes
35 35
 {
36
-	var $boxcode="currentaccounts";
37
-	var $boximg="object_bill";
38
-	var $boxlabel="BoxCurrentAccounts";
39
-	var $depends = array("banque");     // Box active if module banque active
36
+	var $boxcode = "currentaccounts";
37
+	var $boximg = "object_bill";
38
+	var $boxlabel = "BoxCurrentAccounts";
39
+	var $depends = array("banque"); // Box active if module banque active
40 40
 
41 41
 	/**
42 42
      * @var DoliDB Database handler.
@@ -56,17 +56,17 @@  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 $conf, $user;
62 62
 
63 63
 		$this->db = $db;
64 64
 
65 65
 		// disable module for such cases
66
-		$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
67
-		if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
66
+		$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
67
+		if (!in_array('banque', $listofmodulesforexternal) && !empty($user->societe_id)) $this->enabled = 0; // disabled for external users
68 68
 
69
-		$this->hidden = ! ($user->rights->banque->lire);
69
+		$this->hidden = !($user->rights->banque->lire);
70 70
 	}
71 71
 
72 72
 	/**
@@ -75,29 +75,29 @@  discard block
 block discarded – undo
75 75
 	 *  @param	int		$max        Maximum number of records to load
76 76
      *  @return	void
77 77
 	 */
78
-	function loadBox($max=5)
78
+	function loadBox($max = 5)
79 79
 	{
80 80
 		global $user, $langs, $db, $conf;
81 81
 
82
-		$this->max=$max;
82
+		$this->max = $max;
83 83
 
84 84
 		$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
85 85
 
86 86
         if ($user->rights->banque->lire) {
87 87
 			$sql = "SELECT b.rowid, b.ref, b.label, b.bank,b.number, b.courant, b.clos, b.rappro, b.url";
88
-			$sql.= ", b.code_banque, b.code_guichet, b.cle_rib, b.bic, b.iban_prefix as iban";
89
-			$sql.= ", b.domiciliation, b.proprio, b.owner_address";
90
-			$sql.= ", b.account_number, b.currency_code";
91
-			$sql.= ", b.min_allowed, b.min_desired, comment";
92
-            $sql.= ', b.fk_accountancy_journal';
93
-            $sql.= ', aj.code as accountancy_journal';
94
-            $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
95
-            $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_journal as aj ON aj.rowid=b.fk_accountancy_journal';
96
-            $sql.= " WHERE b.entity = ".$conf->entity;
97
-			$sql.= " AND clos = 0";
88
+			$sql .= ", b.code_banque, b.code_guichet, b.cle_rib, b.bic, b.iban_prefix as iban";
89
+			$sql .= ", b.domiciliation, b.proprio, b.owner_address";
90
+			$sql .= ", b.account_number, b.currency_code";
91
+			$sql .= ", b.min_allowed, b.min_desired, comment";
92
+            $sql .= ', b.fk_accountancy_journal';
93
+            $sql .= ', aj.code as accountancy_journal';
94
+            $sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b";
95
+            $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_journal as aj ON aj.rowid=b.fk_accountancy_journal';
96
+            $sql .= " WHERE b.entity = ".$conf->entity;
97
+			$sql .= " AND clos = 0";
98 98
 			//$sql.= " AND courant = 1";
99
-			$sql.= " ORDER BY label";
100
-			$sql.= $db->plimit($max, 0);
99
+			$sql .= " ORDER BY label";
100
+			$sql .= $db->plimit($max, 0);
101 101
 
102 102
             dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
103 103
             $result = $db->query($sql);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                     $account_static->account_number = $objp->account_number;
119 119
                     $account_static->currency_code = $objp->currency_code;
120 120
                     $account_static->accountancy_journal = $objp->accountancy_journal;
121
-                    $solde=$account_static->solde(0);
121
+                    $solde = $account_static->solde(0);
122 122
 
123 123
                     $solde_total[$objp->currency_code] += $solde;
124 124
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 *  @param	int		$nooutput	No print, only return string
185 185
 	 *	@return	string
186 186
 	 */
187
-    function showBox($head = null, $contents = null, $nooutput=0)
187
+    function showBox($head = null, $contents = null, $nooutput = 0)
188 188
     {
189 189
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
190 190
 	}
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,10 @@
 block discarded – undo
64 64
 
65 65
 		// disable module for such cases
66 66
 		$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
67
-		if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
67
+		if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) {
68
+		    $this->enabled=0;
69
+		}
70
+		// disabled for external users
68 71
 
69 72
 		$this->hidden = ! ($user->rights->banque->lire);
70 73
 	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php 3 patches
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -28,255 +28,255 @@
 block discarded – undo
28 28
  */
29 29
 class box_graph_invoices_supplier_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="invoicessupplierpermonth";
32
-	var $boximg="object_bill";
33
-	var $boxlabel="BoxSuppliersInvoicesPerMonth";
34
-	var $depends = array("fournisseur");
31
+    var $boxcode="invoicessupplierpermonth";
32
+    var $boximg="object_bill";
33
+    var $boxlabel="BoxSuppliersInvoicesPerMonth";
34
+    var $depends = array("fournisseur");
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->fournisseur->facture->lire);
58
-	}
57
+        $this->hidden = ! ($user->rights->fournisseur->facture->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;
69
-
70
-		$this->max=$max;
71
-
72
-		$refreshaction='refresh_'.$this->boxcode;
73
-
74
-		include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
75
-
76
-		$text = $langs->trans("BoxSuppliersInvoicesPerMonth",$max);
77
-		$this->info_box_head = array(
78
-				'text' => $text,
79
-				'limit'=> dol_strlen($text),
80
-				'graph'=> 1,
81
-				'sublink'=>'',
82
-				'subtext'=>$langs->trans("Filter"),
83
-				'subpicto'=>'filter.png',
84
-				'subclass'=>'linkobject boxfilter',
85
-				'target'=>'none'	// Set '' to get target="_blank"
86
-		);
87
-
88
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
89
-		$prefix='';
90
-		$socid=0;
91
-		if ($user->societe_id) $socid=$user->societe_id;
92
-		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
93
-
94
-		if ($user->rights->fournisseur->facture->lire)
95
-		{
96
-			$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
97
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
98
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
99
-
100
-			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
101
-			include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
102
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
103
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
104
-			{
105
-				$endyear=GETPOST($param_year,'int');
106
-				$shownb=GETPOST($param_shownb,'alpha');
107
-				$showtot=GETPOST($param_showtot,'alpha');
108
-			}
109
-			else
110
-			{
111
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
112
-				$endyear=$tmparray['year'];
113
-				$shownb=$tmparray['shownb'];
114
-				$showtot=$tmparray['showtot'];
115
-			}
116
-			if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
117
-			$nowarray=dol_getdate(dol_now(),true);
118
-			if (empty($endyear)) $endyear=$nowarray['year'];
119
-			$startyear=$endyear-1;
120
-			$mode='supplier';
121
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
122
-			$HEIGHT='192';
123
-
124
-			$stats = new FactureStats($this->db, $socid, $mode, 0);
125
-
126
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
127
-			if ($shownb)
128
-			{
129
-				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
130
-
131
-				$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
132
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
133
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$year.'.png';
134
-
135
-				$px1 = new DolGraph();
136
-				$mesg = $px1->isGraphKo();
137
-				if (! $mesg)
138
-				{
139
-				    $langs->load("bills");
140
-
141
-				    $px1->SetData($data1);
142
-					unset($data1);
143
-					$px1->SetPrecisionY(0);
144
-					$i=$startyear;$legend=array();
145
-					while ($i <= $endyear)
146
-					{
147
-						$legend[]=$i;
148
-						$i++;
149
-					}
150
-					$px1->SetLegend($legend);
151
-					$px1->SetMaxValue($px1->GetCeilMaxValue());
152
-					$px1->SetWidth($WIDTH);
153
-					$px1->SetHeight($HEIGHT);
154
-					$px1->SetYLabel($langs->trans("NumberOfBills"));
155
-					$px1->SetShading(3);
156
-					$px1->SetHorizTickIncrement(1);
157
-					$px1->SetPrecisionY(0);
158
-					$px1->SetCssPrefix("cssboxes");
159
-					$px1->mode='depth';
160
-					$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
161
-
162
-					$px1->draw($filenamenb,$fileurlnb);
163
-				}
164
-			}
165
-
166
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
167
-			if ($showtot)
168
-			{
169
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
170
-
171
-				$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
172
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
173
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$year.'.png';
174
-
175
-				$px2 = new DolGraph();
176
-				$mesg = $px2->isGraphKo();
177
-				if (! $mesg)
178
-				{
179
-				    $langs->load("bills");
180
-
181
-					$px2->SetData($data2);
182
-					unset($data2);
183
-					$px2->SetPrecisionY(0);
184
-					$i=$startyear;$legend=array();
185
-					while ($i <= $endyear)
186
-					{
187
-						$legend[]=$i;
188
-						$i++;
189
-					}
190
-					$px2->SetLegend($legend);
191
-					$px2->SetMaxValue($px2->GetCeilMaxValue());
192
-					$px2->SetWidth($WIDTH);
193
-					$px2->SetHeight($HEIGHT);
194
-					$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
195
-					$px2->SetShading(3);
196
-					$px2->SetHorizTickIncrement(1);
197
-					$px2->SetPrecisionY(0);
198
-					$px2->SetCssPrefix("cssboxes");
199
-					$px2->mode='depth';
200
-					$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
201
-
202
-					$px2->draw($filenamenb,$fileurlnb);
203
-				}
204
-			}
205
-
206
-			if (empty($conf->use_javascript_ajax))
207
-			{
208
-				$langs->load("errors");
209
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
210
-			}
211
-
212
-			if (! $mesg)
213
-			{
214
-				$stringtoshow='';
215
-				$stringtoshow.='<script type="text/javascript" language="javascript">
65
+     */
66
+    function loadBox($max=5)
67
+    {
68
+        global $conf, $user, $langs, $db;
69
+
70
+        $this->max=$max;
71
+
72
+        $refreshaction='refresh_'.$this->boxcode;
73
+
74
+        include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
75
+
76
+        $text = $langs->trans("BoxSuppliersInvoicesPerMonth",$max);
77
+        $this->info_box_head = array(
78
+                'text' => $text,
79
+                'limit'=> dol_strlen($text),
80
+                'graph'=> 1,
81
+                'sublink'=>'',
82
+                'subtext'=>$langs->trans("Filter"),
83
+                'subpicto'=>'filter.png',
84
+                'subclass'=>'linkobject boxfilter',
85
+                'target'=>'none'	// Set '' to get target="_blank"
86
+        );
87
+
88
+        $dir=''; 	// We don't need a path because image file will not be saved into disk
89
+        $prefix='';
90
+        $socid=0;
91
+        if ($user->societe_id) $socid=$user->societe_id;
92
+        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
93
+
94
+        if ($user->rights->fournisseur->facture->lire)
95
+        {
96
+            $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
97
+            $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
98
+            $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
99
+
100
+            include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
101
+            include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
102
+            $autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
103
+            if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
104
+            {
105
+                $endyear=GETPOST($param_year,'int');
106
+                $shownb=GETPOST($param_shownb,'alpha');
107
+                $showtot=GETPOST($param_showtot,'alpha');
108
+            }
109
+            else
110
+            {
111
+                $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
112
+                $endyear=$tmparray['year'];
113
+                $shownb=$tmparray['shownb'];
114
+                $showtot=$tmparray['showtot'];
115
+            }
116
+            if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
117
+            $nowarray=dol_getdate(dol_now(),true);
118
+            if (empty($endyear)) $endyear=$nowarray['year'];
119
+            $startyear=$endyear-1;
120
+            $mode='supplier';
121
+            $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
122
+            $HEIGHT='192';
123
+
124
+            $stats = new FactureStats($this->db, $socid, $mode, 0);
125
+
126
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
127
+            if ($shownb)
128
+            {
129
+                $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
130
+
131
+                $filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
132
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
133
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$year.'.png';
134
+
135
+                $px1 = new DolGraph();
136
+                $mesg = $px1->isGraphKo();
137
+                if (! $mesg)
138
+                {
139
+                    $langs->load("bills");
140
+
141
+                    $px1->SetData($data1);
142
+                    unset($data1);
143
+                    $px1->SetPrecisionY(0);
144
+                    $i=$startyear;$legend=array();
145
+                    while ($i <= $endyear)
146
+                    {
147
+                        $legend[]=$i;
148
+                        $i++;
149
+                    }
150
+                    $px1->SetLegend($legend);
151
+                    $px1->SetMaxValue($px1->GetCeilMaxValue());
152
+                    $px1->SetWidth($WIDTH);
153
+                    $px1->SetHeight($HEIGHT);
154
+                    $px1->SetYLabel($langs->trans("NumberOfBills"));
155
+                    $px1->SetShading(3);
156
+                    $px1->SetHorizTickIncrement(1);
157
+                    $px1->SetPrecisionY(0);
158
+                    $px1->SetCssPrefix("cssboxes");
159
+                    $px1->mode='depth';
160
+                    $px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
161
+
162
+                    $px1->draw($filenamenb,$fileurlnb);
163
+                }
164
+            }
165
+
166
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
167
+            if ($showtot)
168
+            {
169
+                $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
170
+
171
+                $filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
172
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
173
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$year.'.png';
174
+
175
+                $px2 = new DolGraph();
176
+                $mesg = $px2->isGraphKo();
177
+                if (! $mesg)
178
+                {
179
+                    $langs->load("bills");
180
+
181
+                    $px2->SetData($data2);
182
+                    unset($data2);
183
+                    $px2->SetPrecisionY(0);
184
+                    $i=$startyear;$legend=array();
185
+                    while ($i <= $endyear)
186
+                    {
187
+                        $legend[]=$i;
188
+                        $i++;
189
+                    }
190
+                    $px2->SetLegend($legend);
191
+                    $px2->SetMaxValue($px2->GetCeilMaxValue());
192
+                    $px2->SetWidth($WIDTH);
193
+                    $px2->SetHeight($HEIGHT);
194
+                    $px2->SetYLabel($langs->trans("AmountOfBillsHT"));
195
+                    $px2->SetShading(3);
196
+                    $px2->SetHorizTickIncrement(1);
197
+                    $px2->SetPrecisionY(0);
198
+                    $px2->SetCssPrefix("cssboxes");
199
+                    $px2->mode='depth';
200
+                    $px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
201
+
202
+                    $px2->draw($filenamenb,$fileurlnb);
203
+                }
204
+            }
205
+
206
+            if (empty($conf->use_javascript_ajax))
207
+            {
208
+                $langs->load("errors");
209
+                $mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
210
+            }
211
+
212
+            if (! $mesg)
213
+            {
214
+                $stringtoshow='';
215
+                $stringtoshow.='<script type="text/javascript" language="javascript">
216 216
 					jQuery(document).ready(function() {
217 217
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
218 218
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
219 219
 						});
220 220
 					});
221 221
 					</script>';
222
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
223
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
224
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
225
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
226
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
227
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
228
-				$stringtoshow.=' &nbsp; ';
229
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
230
-				$stringtoshow.='<br>';
231
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
232
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
233
-				$stringtoshow.='</form>';
234
-				$stringtoshow.='</div>';
235
-				if ($shownb && $showtot)
236
-				{
237
-					$stringtoshow.='<div class="fichecenter">';
238
-					$stringtoshow.='<div class="fichehalfleft">';
239
-				}
240
-				if ($shownb) $stringtoshow.=$px1->show();
241
-				if ($shownb && $showtot)
242
-				{
243
-					$stringtoshow.='</div>';
244
-					$stringtoshow.='<div class="fichehalfright">';
245
-				}
246
-				if ($showtot) $stringtoshow.=$px2->show();
247
-				if ($shownb && $showtot)
248
-				{
249
-					$stringtoshow.='</div>';
250
-					$stringtoshow.='</div>';
251
-				}
252
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"','td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
253
-			}
254
-			else
255
-			{
256
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
257
-    	        										'maxlength'=>500,
258
-	            										'text' => $mesg);
259
-			}
260
-		}
261
-		else {
262
-			$this->info_box_contents[0][0] = array(
263
-			    'td' => 'align="left" class="nohover opacitymedium"',
222
+                $stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
223
+                $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
224
+                $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
225
+                $stringtoshow.='<input type="hidden" name="page_y" value="">';
226
+                $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
227
+                $stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
228
+                $stringtoshow.=' &nbsp; ';
229
+                $stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
230
+                $stringtoshow.='<br>';
231
+                $stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
232
+                $stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
233
+                $stringtoshow.='</form>';
234
+                $stringtoshow.='</div>';
235
+                if ($shownb && $showtot)
236
+                {
237
+                    $stringtoshow.='<div class="fichecenter">';
238
+                    $stringtoshow.='<div class="fichehalfleft">';
239
+                }
240
+                if ($shownb) $stringtoshow.=$px1->show();
241
+                if ($shownb && $showtot)
242
+                {
243
+                    $stringtoshow.='</div>';
244
+                    $stringtoshow.='<div class="fichehalfright">';
245
+                }
246
+                if ($showtot) $stringtoshow.=$px2->show();
247
+                if ($shownb && $showtot)
248
+                {
249
+                    $stringtoshow.='</div>';
250
+                    $stringtoshow.='</div>';
251
+                }
252
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"','td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
253
+            }
254
+            else
255
+            {
256
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
257
+                                                        'maxlength'=>500,
258
+                                                        'text' => $mesg);
259
+            }
260
+        }
261
+        else {
262
+            $this->info_box_contents[0][0] = array(
263
+                'td' => 'align="left" class="nohover opacitymedium"',
264 264
                 'text' => $langs->trans("ReadPermissionNotAllowed")
265
-			);
266
-		}
267
-	}
268
-
269
-	/**
270
-	 *	Method to show box
271
-	 *
272
-	 *	@param	array	$head       Array with properties of box title
273
-	 *	@param  array	$contents   Array with properties of box lines
274
-	 *  @param	int		$nooutput	No print, only return string
275
-	 *	@return	string
276
-	 */
265
+            );
266
+        }
267
+    }
268
+
269
+    /**
270
+     *	Method to show box
271
+     *
272
+     *	@param	array	$head       Array with properties of box title
273
+     *	@param  array	$contents   Array with properties of box lines
274
+     *  @param	int		$nooutput	No print, only return string
275
+     *	@return	string
276
+     */
277 277
     function showBox($head = null, $contents = null, $nooutput=0)
278 278
     {
279
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
280
-	}
279
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
280
+    }
281 281
 }
282 282
 
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_invoices_supplier_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="invoicessupplierpermonth";
32
-	var $boximg="object_bill";
33
-	var $boxlabel="BoxSuppliersInvoicesPerMonth";
31
+	var $boxcode = "invoicessupplierpermonth";
32
+	var $boximg = "object_bill";
33
+	var $boxlabel = "BoxSuppliersInvoicesPerMonth";
34 34
 	var $depends = array("fournisseur");
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->fournisseur->facture->lire);
57
+		$this->hidden = !($user->rights->fournisseur->facture->lire);
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,17 +63,17 @@  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.'/fourn/class/fournisseur.facture.class.php';
75 75
 
76
-		$text = $langs->trans("BoxSuppliersInvoicesPerMonth",$max);
76
+		$text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max);
77 77
 		$this->info_box_head = array(
78 78
 				'text' => $text,
79 79
 				'limit'=> dol_strlen($text),
@@ -85,48 +85,48 @@  discard block
 block discarded – undo
85 85
 				'target'=>'none'	// Set '' to get target="_blank"
86 86
 		);
87 87
 
88
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
89
-		$prefix='';
90
-		$socid=0;
91
-		if ($user->societe_id) $socid=$user->societe_id;
92
-		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
88
+		$dir = ''; // We don't need a path because image file will not be saved into disk
89
+		$prefix = '';
90
+		$socid = 0;
91
+		if ($user->societe_id) $socid = $user->societe_id;
92
+		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
93 93
 
94 94
 		if ($user->rights->fournisseur->facture->lire)
95 95
 		{
96
-			$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
97
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
98
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
96
+			$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
97
+			$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
98
+			$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
99 99
 
100 100
 			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
101 101
 			include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
102
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
103
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
102
+			$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
103
+			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
104 104
 			{
105
-				$endyear=GETPOST($param_year,'int');
106
-				$shownb=GETPOST($param_shownb,'alpha');
107
-				$showtot=GETPOST($param_showtot,'alpha');
105
+				$endyear = GETPOST($param_year, 'int');
106
+				$shownb = GETPOST($param_shownb, 'alpha');
107
+				$showtot = GETPOST($param_showtot, 'alpha');
108 108
 			}
109 109
 			else
110 110
 			{
111
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
112
-				$endyear=$tmparray['year'];
113
-				$shownb=$tmparray['shownb'];
114
-				$showtot=$tmparray['showtot'];
111
+				$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
112
+				$endyear = $tmparray['year'];
113
+				$shownb = $tmparray['shownb'];
114
+				$showtot = $tmparray['showtot'];
115 115
 			}
116
-			if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
117
-			$nowarray=dol_getdate(dol_now(),true);
118
-			if (empty($endyear)) $endyear=$nowarray['year'];
119
-			$startyear=$endyear-1;
120
-			$mode='supplier';
121
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
122
-			$HEIGHT='192';
116
+			if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
117
+			$nowarray = dol_getdate(dol_now(), true);
118
+			if (empty($endyear)) $endyear = $nowarray['year'];
119
+			$startyear = $endyear - 1;
120
+			$mode = 'supplier';
121
+			$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
122
+			$HEIGHT = '192';
123 123
 
124 124
 			$stats = new FactureStats($this->db, $socid, $mode, 0);
125 125
 
126 126
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
127 127
 			if ($shownb)
128 128
 			{
129
-				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
129
+				$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
130 130
 
131 131
 				$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
132 132
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
 				$px1 = new DolGraph();
136 136
 				$mesg = $px1->isGraphKo();
137
-				if (! $mesg)
137
+				if (!$mesg)
138 138
 				{
139 139
 				    $langs->load("bills");
140 140
 
141 141
 				    $px1->SetData($data1);
142 142
 					unset($data1);
143 143
 					$px1->SetPrecisionY(0);
144
-					$i=$startyear;$legend=array();
144
+					$i = $startyear; $legend = array();
145 145
 					while ($i <= $endyear)
146 146
 					{
147
-						$legend[]=$i;
147
+						$legend[] = $i;
148 148
 						$i++;
149 149
 					}
150 150
 					$px1->SetLegend($legend);
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 					$px1->SetHorizTickIncrement(1);
157 157
 					$px1->SetPrecisionY(0);
158 158
 					$px1->SetCssPrefix("cssboxes");
159
-					$px1->mode='depth';
159
+					$px1->mode = 'depth';
160 160
 					$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
161 161
 
162
-					$px1->draw($filenamenb,$fileurlnb);
162
+					$px1->draw($filenamenb, $fileurlnb);
163 163
 				}
164 164
 			}
165 165
 
166 166
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
167 167
 			if ($showtot)
168 168
 			{
169
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
169
+				$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
170 170
 
171 171
 				$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
172 172
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 
175 175
 				$px2 = new DolGraph();
176 176
 				$mesg = $px2->isGraphKo();
177
-				if (! $mesg)
177
+				if (!$mesg)
178 178
 				{
179 179
 				    $langs->load("bills");
180 180
 
181 181
 					$px2->SetData($data2);
182 182
 					unset($data2);
183 183
 					$px2->SetPrecisionY(0);
184
-					$i=$startyear;$legend=array();
184
+					$i = $startyear; $legend = array();
185 185
 					while ($i <= $endyear)
186 186
 					{
187
-						$legend[]=$i;
187
+						$legend[] = $i;
188 188
 						$i++;
189 189
 					}
190 190
 					$px2->SetLegend($legend);
@@ -196,64 +196,64 @@  discard block
 block discarded – undo
196 196
 					$px2->SetHorizTickIncrement(1);
197 197
 					$px2->SetPrecisionY(0);
198 198
 					$px2->SetCssPrefix("cssboxes");
199
-					$px2->mode='depth';
199
+					$px2->mode = 'depth';
200 200
 					$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
201 201
 
202
-					$px2->draw($filenamenb,$fileurlnb);
202
+					$px2->draw($filenamenb, $fileurlnb);
203 203
 				}
204 204
 			}
205 205
 
206 206
 			if (empty($conf->use_javascript_ajax))
207 207
 			{
208 208
 				$langs->load("errors");
209
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
209
+				$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
210 210
 			}
211 211
 
212
-			if (! $mesg)
212
+			if (!$mesg)
213 213
 			{
214
-				$stringtoshow='';
215
-				$stringtoshow.='<script type="text/javascript" language="javascript">
214
+				$stringtoshow = '';
215
+				$stringtoshow .= '<script type="text/javascript" language="javascript">
216 216
 					jQuery(document).ready(function() {
217 217
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
218 218
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
219 219
 						});
220 220
 					});
221 221
 					</script>';
222
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
223
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
224
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
225
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
226
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
227
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
228
-				$stringtoshow.=' &nbsp; ';
229
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
230
-				$stringtoshow.='<br>';
231
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
232
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
233
-				$stringtoshow.='</form>';
234
-				$stringtoshow.='</div>';
222
+				$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
223
+				$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
224
+				$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
225
+				$stringtoshow .= '<input type="hidden" name="page_y" value="">';
226
+				$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
227
+				$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfBillsByMonth");
228
+				$stringtoshow .= ' &nbsp; ';
229
+				$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfBillsByMonthHT");
230
+				$stringtoshow .= '<br>';
231
+				$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
232
+				$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
233
+				$stringtoshow .= '</form>';
234
+				$stringtoshow .= '</div>';
235 235
 				if ($shownb && $showtot)
236 236
 				{
237
-					$stringtoshow.='<div class="fichecenter">';
238
-					$stringtoshow.='<div class="fichehalfleft">';
237
+					$stringtoshow .= '<div class="fichecenter">';
238
+					$stringtoshow .= '<div class="fichehalfleft">';
239 239
 				}
240
-				if ($shownb) $stringtoshow.=$px1->show();
240
+				if ($shownb) $stringtoshow .= $px1->show();
241 241
 				if ($shownb && $showtot)
242 242
 				{
243
-					$stringtoshow.='</div>';
244
-					$stringtoshow.='<div class="fichehalfright">';
243
+					$stringtoshow .= '</div>';
244
+					$stringtoshow .= '<div class="fichehalfright">';
245 245
 				}
246
-				if ($showtot) $stringtoshow.=$px2->show();
246
+				if ($showtot) $stringtoshow .= $px2->show();
247 247
 				if ($shownb && $showtot)
248 248
 				{
249
-					$stringtoshow.='</div>';
250
-					$stringtoshow.='</div>';
249
+					$stringtoshow .= '</div>';
250
+					$stringtoshow .= '</div>';
251 251
 				}
252
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"','td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
252
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"', 'textnoformat'=>$stringtoshow);
253 253
 			}
254 254
 			else
255 255
 			{
256
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
256
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"',
257 257
     	        										'maxlength'=>500,
258 258
 	            										'text' => $mesg);
259 259
 			}
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 *  @param	int		$nooutput	No print, only return string
275 275
 	 *	@return	string
276 276
 	 */
277
-    function showBox($head = null, $contents = null, $nooutput=0)
277
+    function showBox($head = null, $contents = null, $nooutput = 0)
278 278
     {
279 279
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
280 280
 	}
Please login to merge, or discard this patch.
Braces   +31 added lines, -15 removed lines patch added patch discarded remove patch
@@ -88,8 +88,13 @@  discard block
 block discarded – undo
88 88
 		$dir=''; 	// We don't need a path because image file will not be saved into disk
89 89
 		$prefix='';
90 90
 		$socid=0;
91
-		if ($user->societe_id) $socid=$user->societe_id;
92
-		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
+		if ($user->societe_id) {
92
+		    $socid=$user->societe_id;
93
+		}
94
+		if (! $user->rights->societe->client->voir || $socid) {
95
+		    $prefix.='private-'.$user->id.'-';
96
+		}
97
+		// If user has no permission to see all, output dir is specific to user
93 98
 
94 99
 		if ($user->rights->fournisseur->facture->lire)
95 100
 		{
@@ -105,8 +110,7 @@  discard block
 block discarded – undo
105 110
 				$endyear=GETPOST($param_year,'int');
106 111
 				$shownb=GETPOST($param_shownb,'alpha');
107 112
 				$showtot=GETPOST($param_showtot,'alpha');
108
-			}
109
-			else
113
+			} else
110 114
 			{
111 115
 				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
112 116
 				$endyear=$tmparray['year'];
@@ -115,7 +119,9 @@  discard block
 block discarded – undo
115 119
 			}
116 120
 			if (empty($shownb) && empty($showtot))  { $shownb=1; $showtot=1; }
117 121
 			$nowarray=dol_getdate(dol_now(),true);
118
-			if (empty($endyear)) $endyear=$nowarray['year'];
122
+			if (empty($endyear)) {
123
+			    $endyear=$nowarray['year'];
124
+			}
119 125
 			$startyear=$endyear-1;
120 126
 			$mode='supplier';
121 127
 			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
@@ -129,8 +135,12 @@  discard block
 block discarded – undo
129 135
 				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
130 136
 
131 137
 				$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
132
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
133
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$year.'.png';
138
+				if ($mode == 'customer') {
139
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
140
+				}
141
+				if ($mode == 'supplier') {
142
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$year.'.png';
143
+				}
134 144
 
135 145
 				$px1 = new DolGraph();
136 146
 				$mesg = $px1->isGraphKo();
@@ -169,8 +179,12 @@  discard block
 block discarded – undo
169 179
 				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
170 180
 
171 181
 				$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
172
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
173
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$year.'.png';
182
+				if ($mode == 'customer') {
183
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
184
+				}
185
+				if ($mode == 'supplier') {
186
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$year.'.png';
187
+				}
174 188
 
175 189
 				$px2 = new DolGraph();
176 190
 				$mesg = $px2->isGraphKo();
@@ -237,28 +251,30 @@  discard block
 block discarded – undo
237 251
 					$stringtoshow.='<div class="fichecenter">';
238 252
 					$stringtoshow.='<div class="fichehalfleft">';
239 253
 				}
240
-				if ($shownb) $stringtoshow.=$px1->show();
254
+				if ($shownb) {
255
+				    $stringtoshow.=$px1->show();
256
+				}
241 257
 				if ($shownb && $showtot)
242 258
 				{
243 259
 					$stringtoshow.='</div>';
244 260
 					$stringtoshow.='<div class="fichehalfright">';
245 261
 				}
246
-				if ($showtot) $stringtoshow.=$px2->show();
262
+				if ($showtot) {
263
+				    $stringtoshow.=$px2->show();
264
+				}
247 265
 				if ($shownb && $showtot)
248 266
 				{
249 267
 					$stringtoshow.='</div>';
250 268
 					$stringtoshow.='</div>';
251 269
 				}
252 270
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"','td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
253
-			}
254
-			else
271
+			} else
255 272
 			{
256 273
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"',	'td' => 'align="left" class="nohover"',
257 274
     	        										'maxlength'=>500,
258 275
 	            										'text' => $mesg);
259 276
 			}
260
-		}
261
-		else {
277
+		} else {
262 278
 			$this->info_box_contents[0][0] = array(
263 279
 			    'td' => 'align="left" class="nohover opacitymedium"',
264 280
                 'text' => $langs->trans("ReadPermissionNotAllowed")
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_members.php 3 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -32,96 +32,96 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class box_members extends ModeleBoxes
34 34
 {
35
-	var $boxcode="lastmembers";
36
-	var $boximg="object_user";
37
-	var $boxlabel="BoxLastMembers";
38
-	var $depends = array("adherent");
35
+    var $boxcode="lastmembers";
36
+    var $boximg="object_user";
37
+    var $boxlabel="BoxLastMembers";
38
+    var $depends = array("adherent");
39 39
 
40
-	/**
40
+    /**
41 41
      * @var DoliDB Database handler.
42 42
      */
43 43
     public $db;
44 44
     
45
-	var $param;
46
-	var $enabled = 1;
45
+    var $param;
46
+    var $enabled = 1;
47 47
 
48
-	var $info_box_head = array();
49
-	var $info_box_contents = array();
48
+    var $info_box_head = array();
49
+    var $info_box_contents = array();
50 50
 
51 51
 
52
-	/**
53
-	 *  Constructor
54
-	 *
55
-	 *  @param  DoliDB	$db      	Database handler
52
+    /**
53
+     *  Constructor
54
+     *
55
+     *  @param  DoliDB	$db      	Database handler
56 56
      *  @param	string	$param		More parameters
57
-	 */
58
-	function __construct($db,$param='')
59
-	{
60
-		global $conf, $user;
57
+     */
58
+    function __construct($db,$param='')
59
+    {
60
+        global $conf, $user;
61 61
 
62
-		$this->db = $db;
62
+        $this->db = $db;
63 63
 
64
-		// disable module for such cases
65
-		$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
66
-		if (! in_array('adherent',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
64
+        // disable module for such cases
65
+        $listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
66
+        if (! in_array('adherent',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
67 67
 
68
-		$this->hidden=! ($user->rights->adherent->lire);
69
-	}
68
+        $this->hidden=! ($user->rights->adherent->lire);
69
+    }
70 70
 
71
-	/**
72
-	 *  Load data into info_box_contents array to show array later.
73
-	 *
74
-	 *  @param	int		$max        Maximum number of records to load
71
+    /**
72
+     *  Load data into info_box_contents array to show array later.
73
+     *
74
+     *  @param	int		$max        Maximum number of records to load
75 75
      *  @return	void
76
-	 */
77
-	function loadBox($max=5)
78
-	{
79
-		global $user, $langs, $db, $conf;
80
-		$langs->load("boxes");
76
+     */
77
+    function loadBox($max=5)
78
+    {
79
+        global $user, $langs, $db, $conf;
80
+        $langs->load("boxes");
81 81
 
82
-		$this->max=$max;
82
+        $this->max=$max;
83 83
 
84 84
         include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
85 85
         $memberstatic=new Adherent($db);
86 86
 
87
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers",$max));
88
-
89
-		if ($user->rights->adherent->lire)
90
-		{
91
-			$sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
92
-			$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
93
-			$sql.= " t.subscription";
94
-			$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
95
-			$sql.= " WHERE a.entity IN (".getEntity('member').")";
96
-			$sql.= " AND a.fk_adherent_type = t.rowid";
97
-			$sql.= " ORDER BY a.tms DESC";
98
-			$sql.= $db->plimit($max, 0);
99
-
100
-			$result = $db->query($sql);
101
-			if ($result)
102
-			{
103
-				$num = $db->num_rows($result);
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
-					$memberstatic->lastname=$objp->lastname;
113
-					$memberstatic->firstname=$objp->firstname;
114
-					$memberstatic->id = $objp->rowid;
87
+        $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers",$max));
88
+
89
+        if ($user->rights->adherent->lire)
90
+        {
91
+            $sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
92
+            $sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
93
+            $sql.= " t.subscription";
94
+            $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
95
+            $sql.= " WHERE a.entity IN (".getEntity('member').")";
96
+            $sql.= " AND a.fk_adherent_type = t.rowid";
97
+            $sql.= " ORDER BY a.tms DESC";
98
+            $sql.= $db->plimit($max, 0);
99
+
100
+            $result = $db->query($sql);
101
+            if ($result)
102
+            {
103
+                $num = $db->num_rows($result);
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
+                    $memberstatic->lastname=$objp->lastname;
113
+                    $memberstatic->firstname=$objp->firstname;
114
+                    $memberstatic->id = $objp->rowid;
115 115
                     $memberstatic->ref = $objp->rowid;
116 116
                     $memberstatic->company = $objp->company;
117 117
 
118
-					if (! empty($objp->fk_soc)) {
119
-						$memberstatic->socid = $objp->fk_soc;
120
-						$memberstatic->fetch_thirdparty();
121
-						$memberstatic->name=$memberstatic->thirdparty->name;
122
-					} else {
123
-						$memberstatic->name=$objp->company;
124
-					}
118
+                    if (! empty($objp->fk_soc)) {
119
+                        $memberstatic->socid = $objp->fk_soc;
120
+                        $memberstatic->fetch_thirdparty();
121
+                        $memberstatic->name=$memberstatic->thirdparty->name;
122
+                    } else {
123
+                        $memberstatic->name=$objp->company;
124
+                    }
125 125
 
126 126
                     $this->info_box_contents[$line][] = array(
127 127
                         'td' => '',
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
         }
171 171
     }
172 172
 
173
-	/**
174
-	 *	Method to show box
175
-	 *
176
-	 *	@param	array	$head       Array with properties of box title
177
-	 *	@param  array	$contents   Array with properties of box lines
178
-	 *  @param	int		$nooutput	No print, only return string
179
-	 *	@return	string
180
-	 */
173
+    /**
174
+     *	Method to show box
175
+     *
176
+     *	@param	array	$head       Array with properties of box title
177
+     *	@param  array	$contents   Array with properties of box lines
178
+     *  @param	int		$nooutput	No print, only return string
179
+     *	@return	string
180
+     */
181 181
     function showBox($head = null, $contents = null, $nooutput=0)
182 182
     {
183
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
184
-	}
183
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
184
+    }
185 185
 }
186 186
 
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class box_members extends ModeleBoxes
34 34
 {
35
-	var $boxcode="lastmembers";
36
-	var $boximg="object_user";
37
-	var $boxlabel="BoxLastMembers";
35
+	var $boxcode = "lastmembers";
36
+	var $boximg = "object_user";
37
+	var $boxlabel = "BoxLastMembers";
38 38
 	var $depends = array("adherent");
39 39
 
40 40
 	/**
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 	 *  @param  DoliDB	$db      	Database handler
56 56
      *  @param	string	$param		More parameters
57 57
 	 */
58
-	function __construct($db,$param='')
58
+	function __construct($db, $param = '')
59 59
 	{
60 60
 		global $conf, $user;
61 61
 
62 62
 		$this->db = $db;
63 63
 
64 64
 		// disable module for such cases
65
-		$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
66
-		if (! in_array('adherent',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
65
+		$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
66
+		if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->societe_id)) $this->enabled = 0; // disabled for external users
67 67
 
68
-		$this->hidden=! ($user->rights->adherent->lire);
68
+		$this->hidden = !($user->rights->adherent->lire);
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,28 +74,28 @@  discard block
 block discarded – undo
74 74
 	 *  @param	int		$max        Maximum number of records to load
75 75
      *  @return	void
76 76
 	 */
77
-	function loadBox($max=5)
77
+	function loadBox($max = 5)
78 78
 	{
79 79
 		global $user, $langs, $db, $conf;
80 80
 		$langs->load("boxes");
81 81
 
82
-		$this->max=$max;
82
+		$this->max = $max;
83 83
 
84 84
         include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
85
-        $memberstatic=new Adherent($db);
85
+        $memberstatic = new Adherent($db);
86 86
 
87
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers",$max));
87
+		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max));
88 88
 
89 89
 		if ($user->rights->adherent->lire)
90 90
 		{
91 91
 			$sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
92
-			$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
93
-			$sql.= " t.subscription";
94
-			$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
95
-			$sql.= " WHERE a.entity IN (".getEntity('member').")";
96
-			$sql.= " AND a.fk_adherent_type = t.rowid";
97
-			$sql.= " ORDER BY a.tms DESC";
98
-			$sql.= $db->plimit($max, 0);
92
+			$sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
93
+			$sql .= " t.subscription";
94
+			$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
95
+			$sql .= " WHERE a.entity IN (".getEntity('member').")";
96
+			$sql .= " AND a.fk_adherent_type = t.rowid";
97
+			$sql .= " ORDER BY a.tms DESC";
98
+			$sql .= $db->plimit($max, 0);
99 99
 
100 100
 			$result = $db->query($sql);
101 101
 			if ($result)
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
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);
109
+					$datec = $db->jdate($objp->datec);
110
+					$datem = $db->jdate($objp->tms);
111 111
 
112
-					$memberstatic->lastname=$objp->lastname;
113
-					$memberstatic->firstname=$objp->firstname;
112
+					$memberstatic->lastname = $objp->lastname;
113
+					$memberstatic->firstname = $objp->firstname;
114 114
 					$memberstatic->id = $objp->rowid;
115 115
                     $memberstatic->ref = $objp->rowid;
116 116
                     $memberstatic->company = $objp->company;
117 117
 
118
-					if (! empty($objp->fk_soc)) {
118
+					if (!empty($objp->fk_soc)) {
119 119
 						$memberstatic->socid = $objp->fk_soc;
120 120
 						$memberstatic->fetch_thirdparty();
121
-						$memberstatic->name=$memberstatic->thirdparty->name;
121
+						$memberstatic->name = $memberstatic->thirdparty->name;
122 122
 					} else {
123
-						$memberstatic->name=$objp->company;
123
+						$memberstatic->name = $objp->company;
124 124
 					}
125 125
 
126 126
                     $this->info_box_contents[$line][] = array(
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 
143 143
                     $this->info_box_contents[$line][] = array(
144 144
                         'td' => 'align="right" width="18"',
145
-                        'text' => $memberstatic->LibStatut($objp->status,$objp->subscription,$db->jdate($objp->date_end_subscription),3),
145
+                        'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $db->jdate($objp->date_end_subscription), 3),
146 146
                     );
147 147
 
148 148
                     $line++;
149 149
                 }
150 150
 
151
-                if ($num==0)
151
+                if ($num == 0)
152 152
                     $this->info_box_contents[$line][0] = array(
153 153
                         'td' => 'align="center"',
154 154
                         'text'=>$langs->trans("NoRecordedCustomers"),
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *  @param	int		$nooutput	No print, only return string
179 179
 	 *	@return	string
180 180
 	 */
181
-    function showBox($head = null, $contents = null, $nooutput=0)
181
+    function showBox($head = null, $contents = null, $nooutput = 0)
182 182
     {
183 183
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
184 184
 	}
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,10 @@  discard block
 block discarded – undo
63 63
 
64 64
 		// disable module for such cases
65 65
 		$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
66
-		if (! in_array('adherent',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0;	// disabled for external users
66
+		if (! in_array('adherent',$listofmodulesforexternal) && ! empty($user->societe_id)) {
67
+		    $this->enabled=0;
68
+		}
69
+		// disabled for external users
67 70
 
68 71
 		$this->hidden=! ($user->rights->adherent->lire);
69 72
 	}
@@ -148,11 +151,12 @@  discard block
 block discarded – undo
148 151
                     $line++;
149 152
                 }
150 153
 
151
-                if ($num==0)
152
-                    $this->info_box_contents[$line][0] = array(
154
+                if ($num==0) {
155
+                                    $this->info_box_contents[$line][0] = array(
153 156
                         'td' => 'align="center"',
154 157
                         'text'=>$langs->trans("NoRecordedCustomers"),
155 158
                     );
159
+                }
156 160
 
157 161
                 $db->free($result);
158 162
             } else {
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_prospect.php 3 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -34,87 +34,87 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class box_prospect extends ModeleBoxes
36 36
 {
37
-	var $boxcode="lastprospects";
38
-	var $boximg="object_company";
39
-	var $boxlabel="BoxLastProspects";
40
-	var $depends = array("societe");
37
+    var $boxcode="lastprospects";
38
+    var $boximg="object_company";
39
+    var $boxlabel="BoxLastProspects";
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 $enabled = 1;
47
+    var $enabled = 1;
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
53
+    /**
54
+     *  Constructor
55
+     *
56
+     *  @param  DoliDB	$db      	Database handler
57 57
      *  @param	string	$param		More parameters
58
-	 */
59
-	function __construct($db,$param='')
60
-	{
61
-		global $conf, $user;
58
+     */
59
+    function __construct($db,$param='')
60
+    {
61
+        global $conf, $user;
62 62
 
63
-		$this->db = $db;
63
+        $this->db = $db;
64 64
 
65
-		// disable box for such cases
66
-		if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0;	// disabled by this option
65
+        // disable box for such cases
66
+        if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0;	// disabled by this option
67 67
 
68
-		$this->hidden=! ($user->rights->societe->lire && empty($user->socid));
69
-	}
68
+        $this->hidden=! ($user->rights->societe->lire && empty($user->socid));
69
+    }
70 70
 
71
-	/**
72
-	 *  Load data into info_box_contents array to show array later.
73
-	 *
74
-	 *  @param	int		$max        Maximum number of records to load
71
+    /**
72
+     *  Load data into info_box_contents array to show array later.
73
+     *
74
+     *  @param	int		$max        Maximum number of records to load
75 75
      *  @return	void
76
-	 */
77
-	function loadBox($max=5)
78
-	{
79
-		global $user, $langs, $db, $conf;
76
+     */
77
+    function loadBox($max=5)
78
+    {
79
+        global $user, $langs, $db, $conf;
80 80
 
81
-		$this->max=$max;
81
+        $this->max=$max;
82 82
 
83
-		$thirdpartystatic=new Client($db);
83
+        $thirdpartystatic=new Client($db);
84 84
 
85
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max));
85
+        $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max));
86 86
 
87
-		if ($user->rights->societe->lire)
88
-		{
89
-			$sql = "SELECT s.nom as name, s.rowid as socid";
90
-			$sql.= ", s.code_client";
87
+        if ($user->rights->societe->lire)
88
+        {
89
+            $sql = "SELECT s.nom as name, s.rowid as socid";
90
+            $sql.= ", s.code_client";
91 91
             $sql.= ", s.client";
92 92
             $sql.= ", s.code_fournisseur";
93 93
             $sql.= ", s.fournisseur";
94 94
             $sql.= ", s.logo";
95
-			$sql.= ", s.fk_stcomm, s.datec, s.tms, s.status";
96
-			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
97
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
98
-			$sql.= " WHERE s.client IN (2, 3)";
99
-			$sql.= " AND s.entity IN (".getEntity('societe').")";
100
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
101
-			if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
102
-			$sql.= " ORDER BY s.tms DESC";
103
-			$sql.= $db->plimit($max, 0);
104
-
105
-			dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
106
-			$resql = $db->query($sql);
107
-			if ($resql)
108
-			{
109
-				$num = $db->num_rows($resql);
110
-
111
-				$line = 0;
112
-				while ($line < $num)
113
-				{
114
-					$objp = $db->fetch_object($resql);
115
-					$datec=$db->jdate($objp->datec);
116
-					$datem=$db->jdate($objp->tms);
117
-					$thirdpartystatic->id = $objp->socid;
95
+            $sql.= ", s.fk_stcomm, s.datec, s.tms, s.status";
96
+            $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
97
+            if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
98
+            $sql.= " WHERE s.client IN (2, 3)";
99
+            $sql.= " AND s.entity IN (".getEntity('societe').")";
100
+            if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
101
+            if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
102
+            $sql.= " ORDER BY s.tms DESC";
103
+            $sql.= $db->plimit($max, 0);
104
+
105
+            dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
106
+            $resql = $db->query($sql);
107
+            if ($resql)
108
+            {
109
+                $num = $db->num_rows($resql);
110
+
111
+                $line = 0;
112
+                while ($line < $num)
113
+                {
114
+                    $objp = $db->fetch_object($resql);
115
+                    $datec=$db->jdate($objp->datec);
116
+                    $datem=$db->jdate($objp->tms);
117
+                    $thirdpartystatic->id = $objp->socid;
118 118
                     $thirdpartystatic->name = $objp->name;
119 119
                     $thirdpartystatic->code_client = $objp->code_client;
120 120
                     $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                     $this->info_box_contents[$line][] = array(
126 126
                         'td' => '',
127 127
                         'text' => $thirdpartystatic->getNomUrl(1),
128
-                    	'asis' => 1,
128
+                        'asis' => 1,
129 129
                     );
130 130
 
131 131
                     $this->info_box_contents[$line][] = array(
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
                 'td' => 'align="left" class="nohover opacitymedium"',
166 166
                 'text' => $langs->trans("ReadPermissionNotAllowed")
167 167
             );
168
-		}
169
-	}
170
-
171
-	/**
172
-	 *	Method to show box
173
-	 *
174
-	 *	@param	array	$head       Array with properties of box title
175
-	 *	@param  array	$contents   Array with properties of box lines
176
-	 *  @param	int		$nooutput	No print, only return string
177
-	 *	@return	string
178
-	 */
168
+        }
169
+    }
170
+
171
+    /**
172
+     *	Method to show box
173
+     *
174
+     *	@param	array	$head       Array with properties of box title
175
+     *	@param  array	$contents   Array with properties of box lines
176
+     *  @param	int		$nooutput	No print, only return string
177
+     *	@return	string
178
+     */
179 179
     function showBox($head = null, $contents = null, $nooutput=0)
180 180
     {
181
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
182
-	}
181
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
182
+    }
183 183
 }
184 184
 
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class box_prospect extends ModeleBoxes
36 36
 {
37
-	var $boxcode="lastprospects";
38
-	var $boximg="object_company";
39
-	var $boxlabel="BoxLastProspects";
37
+	var $boxcode = "lastprospects";
38
+	var $boximg = "object_company";
39
+	var $boxlabel = "BoxLastProspects";
40 40
 	var $depends = array("societe");
41 41
 
42 42
 	/**
@@ -56,16 +56,16 @@  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 $conf, $user;
62 62
 
63 63
 		$this->db = $db;
64 64
 
65 65
 		// disable box for such cases
66
-		if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0;	// disabled by this option
66
+		if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled = 0; // disabled by this option
67 67
 
68
-		$this->hidden=! ($user->rights->societe->lire && empty($user->socid));
68
+		$this->hidden = !($user->rights->societe->lire && empty($user->socid));
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,33 +74,33 @@  discard block
 block discarded – undo
74 74
 	 *  @param	int		$max        Maximum number of records to load
75 75
      *  @return	void
76 76
 	 */
77
-	function loadBox($max=5)
77
+	function loadBox($max = 5)
78 78
 	{
79 79
 		global $user, $langs, $db, $conf;
80 80
 
81
-		$this->max=$max;
81
+		$this->max = $max;
82 82
 
83
-		$thirdpartystatic=new Client($db);
83
+		$thirdpartystatic = new Client($db);
84 84
 
85
-		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max));
85
+		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $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.logo";
95
-			$sql.= ", s.fk_stcomm, s.datec, s.tms, s.status";
96
-			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
97
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
98
-			$sql.= " WHERE s.client IN (2, 3)";
99
-			$sql.= " AND s.entity IN (".getEntity('societe').")";
100
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
101
-			if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
102
-			$sql.= " ORDER BY s.tms DESC";
103
-			$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.logo";
95
+			$sql .= ", s.fk_stcomm, s.datec, s.tms, s.status";
96
+			$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
97
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
98
+			$sql .= " WHERE s.client IN (2, 3)";
99
+			$sql .= " AND s.entity IN (".getEntity('societe').")";
100
+			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
101
+			if ($user->societe_id) $sql .= " AND s.rowid = ".$user->societe_id;
102
+			$sql .= " ORDER BY s.tms DESC";
103
+			$sql .= $db->plimit($max, 0);
104 104
 
105 105
 			dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
106 106
 			$resql = $db->query($sql);
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 				while ($line < $num)
113 113
 				{
114 114
 					$objp = $db->fetch_object($resql);
115
-					$datec=$db->jdate($objp->datec);
116
-					$datem=$db->jdate($objp->tms);
115
+					$datec = $db->jdate($objp->datec);
116
+					$datem = $db->jdate($objp->tms);
117 117
 					$thirdpartystatic->id = $objp->socid;
118 118
                     $thirdpartystatic->name = $objp->name;
119 119
                     $thirdpartystatic->code_client = $objp->code_client;
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
 
136 136
                     $this->info_box_contents[$line][] = array(
137 137
                         'td' => 'align="right" width="18"',
138
-                        'text' => str_replace('img ','img height="14" ',$thirdpartystatic->LibProspCommStatut($objp->fk_stcomm,3)),
138
+                        'text' => str_replace('img ', 'img height="14" ', $thirdpartystatic->LibProspCommStatut($objp->fk_stcomm, 3)),
139 139
                     );
140 140
 
141 141
                     $this->info_box_contents[$line][] = array(
142 142
                         'td' => 'align="right" width="18"',
143
-                        'text' => $thirdpartystatic->LibStatut($objp->status,3),
143
+                        'text' => $thirdpartystatic->LibStatut($objp->status, 3),
144 144
                     );
145 145
 
146 146
                     $line++;
147 147
                 }
148 148
 
149
-                if ($num==0)
149
+                if ($num == 0)
150 150
                     $this->info_box_contents[$line][0] = array(
151 151
                         'td' => 'align="center"',
152 152
                         'text'=>$langs->trans("NoRecordedProspects"),
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 *  @param	int		$nooutput	No print, only return string
177 177
 	 *	@return	string
178 178
 	 */
179
-    function showBox($head = null, $contents = null, $nooutput=0)
179
+    function showBox($head = null, $contents = null, $nooutput = 0)
180 180
     {
181 181
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
182 182
 	}
Please login to merge, or discard this patch.
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,10 @@  discard block
 block discarded – undo
63 63
 		$this->db = $db;
64 64
 
65 65
 		// disable box for such cases
66
-		if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0;	// disabled by this option
66
+		if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
67
+		    $this->enabled=0;
68
+		}
69
+		// disabled by this option
67 70
 
68 71
 		$this->hidden=! ($user->rights->societe->lire && empty($user->socid));
69 72
 	}
@@ -94,11 +97,17 @@  discard block
 block discarded – undo
94 97
             $sql.= ", s.logo";
95 98
 			$sql.= ", s.fk_stcomm, s.datec, s.tms, s.status";
96 99
 			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
97
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
100
+			if (!$user->rights->societe->client->voir && !$user->societe_id) {
101
+			    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
102
+			}
98 103
 			$sql.= " WHERE s.client IN (2, 3)";
99 104
 			$sql.= " AND s.entity IN (".getEntity('societe').")";
100
-			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
101
-			if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
105
+			if (!$user->rights->societe->client->voir && !$user->societe_id) {
106
+			    $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
107
+			}
108
+			if ($user->societe_id) {
109
+			    $sql.= " AND s.rowid = ".$user->societe_id;
110
+			}
102 111
 			$sql.= " ORDER BY s.tms DESC";
103 112
 			$sql.= $db->plimit($max, 0);
104 113
 
@@ -146,11 +155,12 @@  discard block
 block discarded – undo
146 155
                     $line++;
147 156
                 }
148 157
 
149
-                if ($num==0)
150
-                    $this->info_box_contents[$line][0] = array(
158
+                if ($num==0) {
159
+                                    $this->info_box_contents[$line][0] = array(
151 160
                         'td' => 'align="center"',
152 161
                         'text'=>$langs->trans("NoRecordedProspects"),
153 162
                 );
163
+                }
154 164
 
155 165
                 $db->free($resql);
156 166
             } else {
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_graph_orders_supplier_permonth.php 3 patches
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -28,253 +28,253 @@
 block discarded – undo
28 28
  */
29 29
 class box_graph_orders_supplier_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="orderssupplierpermonth";
32
-	var $boximg="object_order";
33
-	var $boxlabel="BoxSuppliersOrdersPerMonth";
34
-	var $depends = array("fournisseur");
31
+    var $boxcode="orderssupplierpermonth";
32
+    var $boximg="object_order";
33
+    var $boxlabel="BoxSuppliersOrdersPerMonth";
34
+    var $depends = array("fournisseur");
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->fournisseur->commande->lire);
58
-	}
57
+        $this->hidden = ! ($user->rights->fournisseur->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.'/fourn/class/fournisseur.commande.class.php';
74
+        include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
75 75
 
76
-		$text = $langs->trans("BoxSuppliersOrdersPerMonth",$max);
77
-		$this->info_box_head = array(
78
-				'text' => $text,
79
-				'limit'=> dol_strlen($text),
80
-				'graph'=> 1,
81
-				'sublink'=>'',
82
-				'subtext'=>$langs->trans("Filter"),
83
-				'subpicto'=>'filter.png',
84
-				'subclass'=>'linkobject boxfilter',
85
-				'target'=>'none'	// Set '' to get target="_blank"
86
-		);
76
+        $text = $langs->trans("BoxSuppliersOrdersPerMonth",$max);
77
+        $this->info_box_head = array(
78
+                'text' => $text,
79
+                'limit'=> dol_strlen($text),
80
+                'graph'=> 1,
81
+                'sublink'=>'',
82
+                'subtext'=>$langs->trans("Filter"),
83
+                'subpicto'=>'filter.png',
84
+                'subclass'=>'linkobject boxfilter',
85
+                'target'=>'none'	// Set '' to get target="_blank"
86
+        );
87 87
 
88
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
89
-		$prefix='';
90
-		$socid=0;
91
-		if ($user->societe_id) $socid=$user->societe_id;
92
-		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
88
+        $dir=''; 	// We don't need a path because image file will not be saved into disk
89
+        $prefix='';
90
+        $socid=0;
91
+        if ($user->societe_id) $socid=$user->societe_id;
92
+        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
93 93
 
94
-		if ($user->rights->fournisseur->commande->lire)
95
-		{
96
-		    $langs->load("orders");
94
+        if ($user->rights->fournisseur->commande->lire)
95
+        {
96
+            $langs->load("orders");
97 97
 
98
-		    $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
99
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
100
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
98
+            $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
99
+            $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
100
+            $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
101 101
 
102
-			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
103
-			include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
104
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
105
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
106
-			{
107
-				$endyear=GETPOST($param_year,'int');
108
-				$shownb=GETPOST($param_shownb,'alpha');
109
-				$showtot=GETPOST($param_showtot,'alpha');
110
-			}
111
-			else
112
-			{
113
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
114
-				$endyear=$tmparray['year'];
115
-				$shownb=$tmparray['shownb'];
116
-				$showtot=$tmparray['showtot'];
117
-			}
118
-			if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
119
-			$nowarray=dol_getdate(dol_now(),true);
120
-			if (empty($endyear)) $endyear=$nowarray['year'];
121
-			$startyear=$endyear-1;
122
-			$mode='supplier';
123
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
124
-			$HEIGHT='192';
102
+            include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
103
+            include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
104
+            $autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
105
+            if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
106
+            {
107
+                $endyear=GETPOST($param_year,'int');
108
+                $shownb=GETPOST($param_shownb,'alpha');
109
+                $showtot=GETPOST($param_showtot,'alpha');
110
+            }
111
+            else
112
+            {
113
+                $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
114
+                $endyear=$tmparray['year'];
115
+                $shownb=$tmparray['shownb'];
116
+                $showtot=$tmparray['showtot'];
117
+            }
118
+            if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
119
+            $nowarray=dol_getdate(dol_now(),true);
120
+            if (empty($endyear)) $endyear=$nowarray['year'];
121
+            $startyear=$endyear-1;
122
+            $mode='supplier';
123
+            $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
124
+            $HEIGHT='192';
125 125
 
126
-			$stats = new CommandeStats($this->db, $socid, $mode, 0);
126
+            $stats = new CommandeStats($this->db, $socid, $mode, 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));
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 132
 
133
-				$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
134
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
135
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssuppliernbinyear-'.$endyear.'.png';
133
+                $filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
134
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
135
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssuppliernbinyear-'.$endyear.'.png';
136 136
 
137
-				$px1 = new DolGraph();
138
-				$mesg = $px1->isGraphKo();
139
-				if (! $mesg)
140
-				{
141
-					$px1->SetData($data1);
142
-					unset($data1);
143
-					$px1->SetPrecisionY(0);
144
-					$i=$startyear;$legend=array();
145
-					while ($i <= $endyear)
146
-					{
147
-						$legend[]=$i;
148
-						$i++;
149
-					}
150
-					$px1->SetLegend($legend);
151
-					$px1->SetMaxValue($px1->GetCeilMaxValue());
152
-					$px1->SetWidth($WIDTH);
153
-					$px1->SetHeight($HEIGHT);
154
-					$px1->SetYLabel($langs->trans("NumberOfOrders"));
155
-					$px1->SetShading(3);
156
-					$px1->SetHorizTickIncrement(1);
157
-					$px1->SetPrecisionY(0);
158
-					$px1->SetCssPrefix("cssboxes");
159
-					$px1->mode='depth';
160
-					$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
137
+                $px1 = new DolGraph();
138
+                $mesg = $px1->isGraphKo();
139
+                if (! $mesg)
140
+                {
141
+                    $px1->SetData($data1);
142
+                    unset($data1);
143
+                    $px1->SetPrecisionY(0);
144
+                    $i=$startyear;$legend=array();
145
+                    while ($i <= $endyear)
146
+                    {
147
+                        $legend[]=$i;
148
+                        $i++;
149
+                    }
150
+                    $px1->SetLegend($legend);
151
+                    $px1->SetMaxValue($px1->GetCeilMaxValue());
152
+                    $px1->SetWidth($WIDTH);
153
+                    $px1->SetHeight($HEIGHT);
154
+                    $px1->SetYLabel($langs->trans("NumberOfOrders"));
155
+                    $px1->SetShading(3);
156
+                    $px1->SetHorizTickIncrement(1);
157
+                    $px1->SetPrecisionY(0);
158
+                    $px1->SetCssPrefix("cssboxes");
159
+                    $px1->mode='depth';
160
+                    $px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
161 161
 
162
-					$px1->draw($filenamenb,$fileurlnb);
163
-				}
164
-			}
162
+                    $px1->draw($filenamenb,$fileurlnb);
163
+                }
164
+            }
165 165
 
166
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
167
-			if ($showtot)
168
-			{
169
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
166
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
167
+            if ($showtot)
168
+            {
169
+                $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
170 170
 
171
-				$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
172
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
173
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssupplieramountinyear-'.$endyear.'.png';
171
+                $filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
172
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
173
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssupplieramountinyear-'.$endyear.'.png';
174 174
 
175
-				$px2 = new DolGraph();
176
-				$mesg = $px2->isGraphKo();
177
-				if (! $mesg)
178
-				{
179
-					$px2->SetData($data2);
180
-					unset($data2);
181
-					$px2->SetPrecisionY(0);
182
-					$i=$startyear;$legend=array();
183
-					while ($i <= $endyear)
184
-					{
185
-						$legend[]=$i;
186
-						$i++;
187
-					}
188
-					$px2->SetLegend($legend);
189
-					$px2->SetMaxValue($px2->GetCeilMaxValue());
190
-					$px2->SetWidth($WIDTH);
191
-					$px2->SetHeight($HEIGHT);
192
-					$px2->SetYLabel($langs->trans("AmountOfOrdersHT"));
193
-					$px2->SetShading(3);
194
-					$px2->SetHorizTickIncrement(1);
195
-					$px2->SetPrecisionY(0);
196
-					$px2->SetCssPrefix("cssboxes");
197
-					$px2->mode='depth';
198
-					$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
175
+                $px2 = new DolGraph();
176
+                $mesg = $px2->isGraphKo();
177
+                if (! $mesg)
178
+                {
179
+                    $px2->SetData($data2);
180
+                    unset($data2);
181
+                    $px2->SetPrecisionY(0);
182
+                    $i=$startyear;$legend=array();
183
+                    while ($i <= $endyear)
184
+                    {
185
+                        $legend[]=$i;
186
+                        $i++;
187
+                    }
188
+                    $px2->SetLegend($legend);
189
+                    $px2->SetMaxValue($px2->GetCeilMaxValue());
190
+                    $px2->SetWidth($WIDTH);
191
+                    $px2->SetHeight($HEIGHT);
192
+                    $px2->SetYLabel($langs->trans("AmountOfOrdersHT"));
193
+                    $px2->SetShading(3);
194
+                    $px2->SetHorizTickIncrement(1);
195
+                    $px2->SetPrecisionY(0);
196
+                    $px2->SetCssPrefix("cssboxes");
197
+                    $px2->mode='depth';
198
+                    $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
199 199
 
200
-					$px2->draw($filenamenb,$fileurlnb);
201
-				}
202
-			}
200
+                    $px2->draw($filenamenb,$fileurlnb);
201
+                }
202
+            }
203 203
 
204
-			if (empty($conf->use_javascript_ajax))
205
-			{
206
-				$langs->load("errors");
207
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
208
-			}
204
+            if (empty($conf->use_javascript_ajax))
205
+            {
206
+                $langs->load("errors");
207
+                $mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
208
+            }
209 209
 
210
-			if (! $mesg)
211
-			{
212
-				$stringtoshow='';
213
-				$stringtoshow.='<script type="text/javascript" language="javascript">
210
+            if (! $mesg)
211
+            {
212
+                $stringtoshow='';
213
+                $stringtoshow.='<script type="text/javascript" language="javascript">
214 214
 					jQuery(document).ready(function() {
215 215
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
216 216
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
217 217
 						});
218 218
 					});
219 219
 					</script>';
220
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
221
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
222
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
223
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
224
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
225
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
226
-				$stringtoshow.=' &nbsp; ';
227
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
228
-				$stringtoshow.='<br>';
229
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
230
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
231
-				$stringtoshow.='</form>';
232
-				$stringtoshow.='</div>';
233
-				if ($shownb && $showtot)
234
-				{
235
-					$stringtoshow.='<div class="fichecenter">';
236
-					$stringtoshow.='<div class="fichehalfleft">';
237
-				}
238
-				if ($shownb) $stringtoshow.=$px1->show();
239
-				if ($shownb && $showtot)
240
-				{
241
-					$stringtoshow.='</div>';
242
-					$stringtoshow.='<div class="fichehalfright">';
243
-				}
244
-				if ($showtot) $stringtoshow.=$px2->show();
245
-				if ($shownb && $showtot)
246
-				{
247
-					$stringtoshow.='</div>';
248
-					$stringtoshow.='</div>';
249
-				}
250
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
251
-			}
252
-			else
253
-			{
254
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"',
255
-    	        										'maxlength'=>500,
256
-	            										'text' => $mesg);
257
-			}
258
-		}
259
-		else {
260
-			$this->info_box_contents[0][0] = array(
261
-			    'td' => 'align="left" class="nohover opacitymedium"',
220
+                $stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
221
+                $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
222
+                $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
223
+                $stringtoshow.='<input type="hidden" name="page_y" value="">';
224
+                $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
225
+                $stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
226
+                $stringtoshow.=' &nbsp; ';
227
+                $stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
228
+                $stringtoshow.='<br>';
229
+                $stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
230
+                $stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
231
+                $stringtoshow.='</form>';
232
+                $stringtoshow.='</div>';
233
+                if ($shownb && $showtot)
234
+                {
235
+                    $stringtoshow.='<div class="fichecenter">';
236
+                    $stringtoshow.='<div class="fichehalfleft">';
237
+                }
238
+                if ($shownb) $stringtoshow.=$px1->show();
239
+                if ($shownb && $showtot)
240
+                {
241
+                    $stringtoshow.='</div>';
242
+                    $stringtoshow.='<div class="fichehalfright">';
243
+                }
244
+                if ($showtot) $stringtoshow.=$px2->show();
245
+                if ($shownb && $showtot)
246
+                {
247
+                    $stringtoshow.='</div>';
248
+                    $stringtoshow.='</div>';
249
+                }
250
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
251
+            }
252
+            else
253
+            {
254
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"',
255
+                                                        'maxlength'=>500,
256
+                                                        'text' => $mesg);
257
+            }
258
+        }
259
+        else {
260
+            $this->info_box_contents[0][0] = array(
261
+                'td' => 'align="left" class="nohover opacitymedium"',
262 262
                 'text' => $langs->trans("ReadPermissionNotAllowed")
263
-			);
264
-		}
265
-	}
263
+            );
264
+        }
265
+    }
266 266
 
267
-	/**
268
-	 *	Method to show box
269
-	 *
270
-	 *	@param	array	$head       Array with properties of box title
271
-	 *	@param  array	$contents   Array with properties of box lines
272
-	 *  @param	int		$nooutput	No print, only return string
273
-	 *	@return	string
274
-	 */
267
+    /**
268
+     *	Method to show box
269
+     *
270
+     *	@param	array	$head       Array with properties of box title
271
+     *	@param  array	$contents   Array with properties of box lines
272
+     *  @param	int		$nooutput	No print, only return string
273
+     *	@return	string
274
+     */
275 275
     function showBox($head = null, $contents = null, $nooutput=0)
276 276
     {
277
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
278
-	}
277
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
278
+    }
279 279
 }
280 280
 
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 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_supplier_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="orderssupplierpermonth";
32
-	var $boximg="object_order";
33
-	var $boxlabel="BoxSuppliersOrdersPerMonth";
31
+	var $boxcode = "orderssupplierpermonth";
32
+	var $boximg = "object_order";
33
+	var $boxlabel = "BoxSuppliersOrdersPerMonth";
34 34
 	var $depends = array("fournisseur");
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->fournisseur->commande->lire);
57
+		$this->hidden = !($user->rights->fournisseur->commande->lire);
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,17 +63,17 @@  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.'/fourn/class/fournisseur.commande.class.php';
75 75
 
76
-		$text = $langs->trans("BoxSuppliersOrdersPerMonth",$max);
76
+		$text = $langs->trans("BoxSuppliersOrdersPerMonth", $max);
77 77
 		$this->info_box_head = array(
78 78
 				'text' => $text,
79 79
 				'limit'=> dol_strlen($text),
@@ -85,50 +85,50 @@  discard block
 block discarded – undo
85 85
 				'target'=>'none'	// Set '' to get target="_blank"
86 86
 		);
87 87
 
88
-		$dir=''; 	// We don't need a path because image file will not be saved into disk
89
-		$prefix='';
90
-		$socid=0;
91
-		if ($user->societe_id) $socid=$user->societe_id;
92
-		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
88
+		$dir = ''; // We don't need a path because image file will not be saved into disk
89
+		$prefix = '';
90
+		$socid = 0;
91
+		if ($user->societe_id) $socid = $user->societe_id;
92
+		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
93 93
 
94 94
 		if ($user->rights->fournisseur->commande->lire)
95 95
 		{
96 96
 		    $langs->load("orders");
97 97
 
98
-		    $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
99
-			$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
100
-			$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
98
+		    $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
99
+			$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
100
+			$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
101 101
 
102 102
 			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
103 103
 			include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
104
-			$autosetarray=preg_split("/[,;:]+/",GETPOST('DOL_AUTOSET_COOKIE'));
105
-			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode,$autosetarray))
104
+			$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
105
+			if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
106 106
 			{
107
-				$endyear=GETPOST($param_year,'int');
108
-				$shownb=GETPOST($param_shownb,'alpha');
109
-				$showtot=GETPOST($param_showtot,'alpha');
107
+				$endyear = GETPOST($param_year, 'int');
108
+				$shownb = GETPOST($param_shownb, 'alpha');
109
+				$showtot = GETPOST($param_showtot, 'alpha');
110 110
 			}
111 111
 			else
112 112
 			{
113
-				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
114
-				$endyear=$tmparray['year'];
115
-				$shownb=$tmparray['shownb'];
116
-				$showtot=$tmparray['showtot'];
113
+				$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
114
+				$endyear = $tmparray['year'];
115
+				$shownb = $tmparray['shownb'];
116
+				$showtot = $tmparray['showtot'];
117 117
 			}
118
-			if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
119
-			$nowarray=dol_getdate(dol_now(),true);
120
-			if (empty($endyear)) $endyear=$nowarray['year'];
121
-			$startyear=$endyear-1;
122
-			$mode='supplier';
123
-			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
124
-			$HEIGHT='192';
118
+			if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
119
+			$nowarray = dol_getdate(dol_now(), true);
120
+			if (empty($endyear)) $endyear = $nowarray['year'];
121
+			$startyear = $endyear - 1;
122
+			$mode = 'supplier';
123
+			$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
124
+			$HEIGHT = '192';
125 125
 
126 126
 			$stats = new CommandeStats($this->db, $socid, $mode, 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));
131
+				$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
132 132
 
133 133
 				$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
134 134
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 
137 137
 				$px1 = new DolGraph();
138 138
 				$mesg = $px1->isGraphKo();
139
-				if (! $mesg)
139
+				if (!$mesg)
140 140
 				{
141 141
 					$px1->SetData($data1);
142 142
 					unset($data1);
143 143
 					$px1->SetPrecisionY(0);
144
-					$i=$startyear;$legend=array();
144
+					$i = $startyear; $legend = array();
145 145
 					while ($i <= $endyear)
146 146
 					{
147
-						$legend[]=$i;
147
+						$legend[] = $i;
148 148
 						$i++;
149 149
 					}
150 150
 					$px1->SetLegend($legend);
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 					$px1->SetHorizTickIncrement(1);
157 157
 					$px1->SetPrecisionY(0);
158 158
 					$px1->SetCssPrefix("cssboxes");
159
-					$px1->mode='depth';
159
+					$px1->mode = 'depth';
160 160
 					$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
161 161
 
162
-					$px1->draw($filenamenb,$fileurlnb);
162
+					$px1->draw($filenamenb, $fileurlnb);
163 163
 				}
164 164
 			}
165 165
 
166 166
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
167 167
 			if ($showtot)
168 168
 			{
169
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
169
+				$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
170 170
 
171 171
 				$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
172 172
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
 
175 175
 				$px2 = new DolGraph();
176 176
 				$mesg = $px2->isGraphKo();
177
-				if (! $mesg)
177
+				if (!$mesg)
178 178
 				{
179 179
 					$px2->SetData($data2);
180 180
 					unset($data2);
181 181
 					$px2->SetPrecisionY(0);
182
-					$i=$startyear;$legend=array();
182
+					$i = $startyear; $legend = array();
183 183
 					while ($i <= $endyear)
184 184
 					{
185
-						$legend[]=$i;
185
+						$legend[] = $i;
186 186
 						$i++;
187 187
 					}
188 188
 					$px2->SetLegend($legend);
@@ -194,60 +194,60 @@  discard block
 block discarded – undo
194 194
 					$px2->SetHorizTickIncrement(1);
195 195
 					$px2->SetPrecisionY(0);
196 196
 					$px2->SetCssPrefix("cssboxes");
197
-					$px2->mode='depth';
197
+					$px2->mode = 'depth';
198 198
 					$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
199 199
 
200
-					$px2->draw($filenamenb,$fileurlnb);
200
+					$px2->draw($filenamenb, $fileurlnb);
201 201
 				}
202 202
 			}
203 203
 
204 204
 			if (empty($conf->use_javascript_ajax))
205 205
 			{
206 206
 				$langs->load("errors");
207
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
207
+				$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
208 208
 			}
209 209
 
210
-			if (! $mesg)
210
+			if (!$mesg)
211 211
 			{
212
-				$stringtoshow='';
213
-				$stringtoshow.='<script type="text/javascript" language="javascript">
212
+				$stringtoshow = '';
213
+				$stringtoshow .= '<script type="text/javascript" language="javascript">
214 214
 					jQuery(document).ready(function() {
215 215
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
216 216
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
217 217
 						});
218 218
 					});
219 219
 					</script>';
220
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
221
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
222
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
223
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
224
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
225
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
226
-				$stringtoshow.=' &nbsp; ';
227
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
228
-				$stringtoshow.='<br>';
229
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
230
-				$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
231
-				$stringtoshow.='</form>';
232
-				$stringtoshow.='</div>';
220
+				$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
221
+				$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
222
+				$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
223
+				$stringtoshow .= '<input type="hidden" name="page_y" value="">';
224
+				$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
225
+				$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfOrdersByMonth");
226
+				$stringtoshow .= ' &nbsp; ';
227
+				$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfOrdersByMonthHT");
228
+				$stringtoshow .= '<br>';
229
+				$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
230
+				$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
231
+				$stringtoshow .= '</form>';
232
+				$stringtoshow .= '</div>';
233 233
 				if ($shownb && $showtot)
234 234
 				{
235
-					$stringtoshow.='<div class="fichecenter">';
236
-					$stringtoshow.='<div class="fichehalfleft">';
235
+					$stringtoshow .= '<div class="fichecenter">';
236
+					$stringtoshow .= '<div class="fichehalfleft">';
237 237
 				}
238
-				if ($shownb) $stringtoshow.=$px1->show();
238
+				if ($shownb) $stringtoshow .= $px1->show();
239 239
 				if ($shownb && $showtot)
240 240
 				{
241
-					$stringtoshow.='</div>';
242
-					$stringtoshow.='<div class="fichehalfright">';
241
+					$stringtoshow .= '</div>';
242
+					$stringtoshow .= '<div class="fichehalfright">';
243 243
 				}
244
-				if ($showtot) $stringtoshow.=$px2->show();
244
+				if ($showtot) $stringtoshow .= $px2->show();
245 245
 				if ($shownb && $showtot)
246 246
 				{
247
-					$stringtoshow.='</div>';
248
-					$stringtoshow.='</div>';
247
+					$stringtoshow .= '</div>';
248
+					$stringtoshow .= '</div>';
249 249
 				}
250
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
250
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"', 'textnoformat'=>$stringtoshow);
251 251
 			}
252 252
 			else
253 253
 			{
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 *  @param	int		$nooutput	No print, only return string
273 273
 	 *	@return	string
274 274
 	 */
275
-    function showBox($head = null, $contents = null, $nooutput=0)
275
+    function showBox($head = null, $contents = null, $nooutput = 0)
276 276
     {
277 277
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
278 278
 	}
Please login to merge, or discard this patch.
Braces   +31 added lines, -15 removed lines patch added patch discarded remove patch
@@ -88,8 +88,13 @@  discard block
 block discarded – undo
88 88
 		$dir=''; 	// We don't need a path because image file will not be saved into disk
89 89
 		$prefix='';
90 90
 		$socid=0;
91
-		if ($user->societe_id) $socid=$user->societe_id;
92
-		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
+		if ($user->societe_id) {
92
+		    $socid=$user->societe_id;
93
+		}
94
+		if (! $user->rights->societe->client->voir || $socid) {
95
+		    $prefix.='private-'.$user->id.'-';
96
+		}
97
+		// If user has no permission to see all, output dir is specific to user
93 98
 
94 99
 		if ($user->rights->fournisseur->commande->lire)
95 100
 		{
@@ -107,8 +112,7 @@  discard block
 block discarded – undo
107 112
 				$endyear=GETPOST($param_year,'int');
108 113
 				$shownb=GETPOST($param_shownb,'alpha');
109 114
 				$showtot=GETPOST($param_showtot,'alpha');
110
-			}
111
-			else
115
+			} else
112 116
 			{
113 117
 				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
114 118
 				$endyear=$tmparray['year'];
@@ -117,7 +121,9 @@  discard block
 block discarded – undo
117 121
 			}
118 122
 			if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
119 123
 			$nowarray=dol_getdate(dol_now(),true);
120
-			if (empty($endyear)) $endyear=$nowarray['year'];
124
+			if (empty($endyear)) {
125
+			    $endyear=$nowarray['year'];
126
+			}
121 127
 			$startyear=$endyear-1;
122 128
 			$mode='supplier';
123 129
 			$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
@@ -131,8 +137,12 @@  discard block
 block discarded – undo
131 137
 				$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
132 138
 
133 139
 				$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
134
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
135
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssuppliernbinyear-'.$endyear.'.png';
140
+				if ($mode == 'customer') {
141
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
142
+				}
143
+				if ($mode == 'supplier') {
144
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssuppliernbinyear-'.$endyear.'.png';
145
+				}
136 146
 
137 147
 				$px1 = new DolGraph();
138 148
 				$mesg = $px1->isGraphKo();
@@ -169,8 +179,12 @@  discard block
 block discarded – undo
169 179
 				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
170 180
 
171 181
 				$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
172
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
173
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssupplieramountinyear-'.$endyear.'.png';
182
+				if ($mode == 'customer') {
183
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
184
+				}
185
+				if ($mode == 'supplier') {
186
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssupplieramountinyear-'.$endyear.'.png';
187
+				}
174 188
 
175 189
 				$px2 = new DolGraph();
176 190
 				$mesg = $px2->isGraphKo();
@@ -235,28 +249,30 @@  discard block
 block discarded – undo
235 249
 					$stringtoshow.='<div class="fichecenter">';
236 250
 					$stringtoshow.='<div class="fichehalfleft">';
237 251
 				}
238
-				if ($shownb) $stringtoshow.=$px1->show();
252
+				if ($shownb) {
253
+				    $stringtoshow.=$px1->show();
254
+				}
239 255
 				if ($shownb && $showtot)
240 256
 				{
241 257
 					$stringtoshow.='</div>';
242 258
 					$stringtoshow.='<div class="fichehalfright">';
243 259
 				}
244
-				if ($showtot) $stringtoshow.=$px2->show();
260
+				if ($showtot) {
261
+				    $stringtoshow.=$px2->show();
262
+				}
245 263
 				if ($shownb && $showtot)
246 264
 				{
247 265
 					$stringtoshow.='</div>';
248 266
 					$stringtoshow.='</div>';
249 267
 				}
250 268
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
251
-			}
252
-			else
269
+			} else
253 270
 			{
254 271
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"',
255 272
     	        										'maxlength'=>500,
256 273
 	            										'text' => $mesg);
257 274
 			}
258
-		}
259
-		else {
275
+		} else {
260 276
 			$this->info_box_contents[0][0] = array(
261 277
 			    'td' => 'align="left" class="nohover opacitymedium"',
262 278
                 'text' => $langs->trans("ReadPermissionNotAllowed")
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_last_modified_ticket.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 
72 72
         $text = $langs->trans("BoxLastModifiedTicketDescription", $max);
73 73
         $this->info_box_head = array(
74
-         'text' => $text,
75
-         'limit' => dol_strlen($text)
74
+            'text' => $text,
75
+            'limit' => dol_strlen($text)
76 76
         );
77 77
 
78 78
         $this->info_box_contents[0][0] = array('td' => 'align="left"',
79
-         'text' => $langs->trans("BoxLastModifiedTicketContent"));
79
+            'text' => $langs->trans("BoxLastModifiedTicketContent"));
80 80
 
81 81
         if ($user->rights->ticket->read) {
82 82
             $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email ";
@@ -119,39 +119,39 @@  discard block
 block discarded – undo
119 119
 
120 120
                     // Picto
121 121
                     $this->info_box_contents[$i][0] = array(
122
-                     'td' => 'align="left" width="16"',
123
-                     'logo' => $this->boximg,
124
-                     'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1));
122
+                        'td' => 'align="left" width="16"',
123
+                        'logo' => $this->boximg,
124
+                        'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1));
125 125
                     $r++;
126 126
 
127 127
                     // Id
128 128
                     $this->info_box_contents[$i][$r] = array(
129
-                     'td' => 'align="left"',
130
-                     'text' => $objp->ref,
131
-                     'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1));
129
+                        'td' => 'align="left"',
130
+                        'text' => $objp->ref,
131
+                        'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1));
132 132
                     $r++;
133 133
 
134 134
                     // Subject
135 135
                     $this->info_box_contents[$i][$r] = array(
136
-                     'td' => 'align="left"',
137
-                     'text' => $objp->subject,    // Some event have no ref
138
-                     'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1));
136
+                        'td' => 'align="left"',
137
+                        'text' => $objp->subject,    // Some event have no ref
138
+                        'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1));
139 139
                     $r++;
140 140
 
141 141
                     // Customer
142 142
                     $this->info_box_contents[$i][$r] = array(
143
-                     'td' => 'align="left"',
144
-                     'logo' => ($objp->fk_soc>0?'company':''),
145
-                     'text' => ($objp->company_name?$objp->company_name:$objp->origin_email),
146
-                     'url' => ($objp->fk_soc>0?DOL_URL_ROOT."/comm/card.php?socid=".$objp->fk_soc:'')
143
+                        'td' => 'align="left"',
144
+                        'logo' => ($objp->fk_soc>0?'company':''),
145
+                        'text' => ($objp->company_name?$objp->company_name:$objp->origin_email),
146
+                        'url' => ($objp->fk_soc>0?DOL_URL_ROOT."/comm/card.php?socid=".$objp->fk_soc:'')
147 147
                     );
148 148
                     $r++;
149 149
 
150 150
 
151 151
                     // Date creation
152 152
                     $this->info_box_contents[$i][$r] = array(
153
-                     'td' => 'align="right"',
154
-                     'text' => dol_print_date($db->idate($objp->datec), 'dayhour')
153
+                        'td' => 'align="right"',
154
+                        'text' => dol_print_date($db->idate($objp->datec), 'dayhour')
155 155
                     );
156 156
                     $r++;
157 157
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                     $ticketstat = new Ticket($this->db);
160 160
                     $ticketstat->fk_statut = $objp->fk_statut;
161 161
                     $this->info_box_contents[$i][$r] = array(
162
-                     'td' => 'align="right"',
163
-                     'text' => $ticketstat->getLibStatut(3)
162
+                        'td' => 'align="right"',
163
+                        'text' => $ticketstat->getLibStatut(3)
164 164
                     );
165 165
                     $r++;
166 166
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             }
176 176
         } else {
177 177
             $this->info_box_contents[0][0] = array('td' => 'align="left"',
178
-             'text' => $langs->trans("ReadPermissionNotAllowed"));
178
+                'text' => $langs->trans("ReadPermissionNotAllowed"));
179 179
         }
180 180
     }
181 181
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *     \ingroup     ticket
23 23
  *     \brief       This box shows latest modified tickets
24 24
  */
25
-require_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php";
25
+require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
26 26
 
27 27
 /**
28 28
  * Class to manage the box
@@ -80,42 +80,42 @@  discard block
 block discarded – undo
80 80
 
81 81
         if ($user->rights->ticket->read) {
82 82
             $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email ";
83
-            $sql.= ", type.label as type_label, category.label as category_label, severity.label as severity_label";
84
-            $sql.= ", s.nom as company_name";
85
-            $sql.= " FROM ".MAIN_DB_PREFIX."ticket as t";
86
-            $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code";
87
-            $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code";
88
-            $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code";
89
-            $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc";
90
-
91
-            $sql.= " WHERE t.entity = ".$conf->entity;
83
+            $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label";
84
+            $sql .= ", s.nom as company_name";
85
+            $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
86
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code";
87
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code";
88
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code";
89
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc";
90
+
91
+            $sql .= " WHERE t.entity = ".$conf->entity;
92 92
             //  		$sql.= " AND e.rowid = er.fk_event";
93 93
             //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
94 94
             if ($user->societe_id) {
95
-                $sql.= " AND t.fk_soc= ".$user->societe_id;
95
+                $sql .= " AND t.fk_soc= ".$user->societe_id;
96 96
             }
97 97
 
98
-            $sql.= " ORDER BY t.tms DESC, t.rowid DESC ";
99
-            $sql.= $db->plimit($max, 0);
98
+            $sql .= " ORDER BY t.tms DESC, t.rowid DESC ";
99
+            $sql .= $db->plimit($max, 0);
100 100
 
101 101
             $resql = $db->query($sql);
102 102
             if ($resql) {
103 103
                 $num = $db->num_rows($resql);
104
-                $now=gmmktime();
104
+                $now = gmmktime();
105 105
 
106 106
                 $i = 0;
107 107
 
108 108
                 while ($i < $num) {
109 109
                     $objp = $db->fetch_object($resql);
110
-                    $datec=$db->jdate($objp->datec);
111
-                    $dateterm=$db->jdate($objp->fin_validite);
112
-                    $dateclose=$db->jdate($objp->date_cloture);
110
+                    $datec = $db->jdate($objp->datec);
111
+                    $dateterm = $db->jdate($objp->fin_validite);
112
+                    $dateclose = $db->jdate($objp->date_cloture);
113 113
                     $late = '';
114 114
 
115 115
                     $ticket = new Ticket($this->db);
116 116
 
117 117
 
118
-                    $r=0;
118
+                    $r = 0;
119 119
 
120 120
                     // Picto
121 121
                     $this->info_box_contents[$i][0] = array(
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
                     // Subject
135 135
                     $this->info_box_contents[$i][$r] = array(
136 136
                      'td' => 'align="left"',
137
-                     'text' => $objp->subject,    // Some event have no ref
137
+                     'text' => $objp->subject, // Some event have no ref
138 138
                      'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1));
139 139
                     $r++;
140 140
 
141 141
                     // Customer
142 142
                     $this->info_box_contents[$i][$r] = array(
143 143
                      'td' => 'align="left"',
144
-                     'logo' => ($objp->fk_soc>0?'company':''),
145
-                     'text' => ($objp->company_name?$objp->company_name:$objp->origin_email),
146
-                     'url' => ($objp->fk_soc>0?DOL_URL_ROOT."/comm/card.php?socid=".$objp->fk_soc:'')
144
+                     'logo' => ($objp->fk_soc > 0 ? 'company' : ''),
145
+                     'text' => ($objp->company_name ? $objp->company_name : $objp->origin_email),
146
+                     'url' => ($objp->fk_soc > 0 ?DOL_URL_ROOT."/comm/card.php?socid=".$objp->fk_soc : '')
147 147
                     );
148 148
                     $r++;
149 149
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
                     $i++;
168 168
                 }
169 169
 
170
-                if ($num==0) {
171
-                    $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("BoxLastModifiedTicketNoRecordedTickets"));
170
+                if ($num == 0) {
171
+                    $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text'=>$langs->trans("BoxLastModifiedTicketNoRecordedTickets"));
172 172
                 }
173 173
             } else {
174 174
                 dol_print_error($db);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      *     @param  int   $nooutput No print, only return string
188 188
      *     @return string
189 189
      */
190
-    function showBox($head = null, $contents = null, $nooutput=0)
190
+    function showBox($head = null, $contents = null, $nooutput = 0)
191 191
     {
192 192
         parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
193 193
     }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_task.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@
 block discarded – undo
131 131
 
132 132
 					$i++;
133 133
 				}
134
+			} else {
135
+			    dol_print_error($this->db);
134 136
 			}
135
-			else dol_print_error($this->db);
136 137
 		}
137 138
 
138 139
 
Please login to merge, or discard this patch.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -69,47 +69,47 @@  discard block
 block discarded – undo
69 69
         $this->hidden = ! ($user->rights->projet->lire);
70 70
     }
71 71
 
72
-	/**
73
-	 *  Load data for box to show them later
74
-	 *
75
-	 *  @param  int     $max        Maximum number of records to load
76
-	 *  @return void
77
-	 */
78
-	function loadBox($max=5)
79
-	{
80
-		global $conf, $user, $langs, $db;
81
-
82
-		$this->max=$max;
83
-
84
-		$totalMnt = 0;
85
-		$totalnb = 0;
86
-		$totalDuree=0;
87
-		$totalplannedtot=0;
88
-		$totaldurationtot=0;
72
+    /**
73
+     *  Load data for box to show them later
74
+     *
75
+     *  @param  int     $max        Maximum number of records to load
76
+     *  @return void
77
+     */
78
+    function loadBox($max=5)
79
+    {
80
+        global $conf, $user, $langs, $db;
81
+
82
+        $this->max=$max;
83
+
84
+        $totalMnt = 0;
85
+        $totalnb = 0;
86
+        $totalDuree=0;
87
+        $totalplannedtot=0;
88
+        $totaldurationtot=0;
89 89
 		
90
-		include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
91
-		$taskstatic=new Task($db);
92
-
93
-
94
-		$textHead = $langs->trans("Tasks")."&nbsp;".date("Y");
95
-		$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
96
-
97
-		// list the summary of the orders
98
-		if ($user->rights->projet->lire) {
99
-			// FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless.
100
-			$sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
101
-			$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
102
-			$sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'";
103
-			$sql.= " AND pt.rowid = ptt.fk_task";
104
-			$sql.= " GROUP BY pt.fk_statut ";
105
-			$sql.= " ORDER BY pt.fk_statut DESC";
106
-			$sql.= $db->plimit($max, 0);
107
-
108
-			$result = $db->query($sql);
109
-			if ($result)
110
-			{
111
-				$num = $db->num_rows($result);
112
-				$i = 0;
90
+        include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
91
+        $taskstatic=new Task($db);
92
+
93
+
94
+        $textHead = $langs->trans("Tasks")."&nbsp;".date("Y");
95
+        $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
96
+
97
+        // list the summary of the orders
98
+        if ($user->rights->projet->lire) {
99
+            // FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless.
100
+            $sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
101
+            $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
102
+            $sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'";
103
+            $sql.= " AND pt.rowid = ptt.fk_task";
104
+            $sql.= " GROUP BY pt.fk_statut ";
105
+            $sql.= " ORDER BY pt.fk_statut DESC";
106
+            $sql.= $db->plimit($max, 0);
107
+
108
+            $result = $db->query($sql);
109
+            if ($result)
110
+            {
111
+                $num = $db->num_rows($result);
112
+                $i = 0;
113 113
                 while ($i < $num)
114 114
                 {
115 115
                     $objp = $db->fetch_object($result);
@@ -124,39 +124,39 @@  discard block
 block discarded – undo
124 124
                         //'url' => DOL_URL_ROOT."/projet/tasks/list.php?leftmenu=projects&viewstatut=".$objp->fk_statut,
125 125
                         'url' => BASE_URI . "?controller=projet/tasks&method=list&leftmenu=projects&viewstatut=" . $objp->fk_statut,
126 126
                     );
127
-					$totalnb += $objp->nb;
128
-					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5));
129
-					$totalplannedtot += $objp->plannedtot;
130
-					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5));
131
-					$totaldurationtot += $objp->durationtot;
132
-
133
-					$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3));
134
-
135
-					$i++;
136
-				}
137
-			}
138
-			else dol_print_error($this->db);
139
-		}
140
-
141
-
142
-		// Add the sum at the bottom of the boxes
143
-		$this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")."&nbsp;".$textHead);
144
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));
145
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5));
146
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5));
147
-		$this->info_box_contents[$i][] = array('td' => '', 'text' => "");
148
-	}
149
-
150
-	/**
151
-	 *	Method to show box
152
-	 *
153
-	 *	@param	array	$head       Array with properties of box title
154
-	 *	@param  array	$contents   Array with properties of box lines
155
-	 *  @param	int		$nooutput	No print, only return string
156
-	 *	@return	string
157
-	 */
158
-	function showBox($head = null, $contents = null, $nooutput=0)
159
-	{
160
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
161
-	}
127
+                    $totalnb += $objp->nb;
128
+                    $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5));
129
+                    $totalplannedtot += $objp->plannedtot;
130
+                    $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5));
131
+                    $totaldurationtot += $objp->durationtot;
132
+
133
+                    $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3));
134
+
135
+                    $i++;
136
+                }
137
+            }
138
+            else dol_print_error($this->db);
139
+        }
140
+
141
+
142
+        // Add the sum at the bottom of the boxes
143
+        $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")."&nbsp;".$textHead);
144
+        $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));
145
+        $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5));
146
+        $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5));
147
+        $this->info_box_contents[$i][] = array('td' => '', 'text' => "");
148
+    }
149
+
150
+    /**
151
+     *	Method to show box
152
+     *
153
+     *	@param	array	$head       Array with properties of box title
154
+     *	@param  array	$contents   Array with properties of box lines
155
+     *  @param	int		$nooutput	No print, only return string
156
+     *	@return	string
157
+     */
158
+    function showBox($head = null, $contents = null, $nooutput=0)
159
+    {
160
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
161
+    }
162 162
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class box_task extends ModeleBoxes
35 35
 {
36
-    public $boxcode="projet";
37
-    public $boximg="object_projecttask";
36
+    public $boxcode = "projet";
37
+    public $boximg = "object_projecttask";
38 38
     public $boxlabel;
39 39
     //public $depends = array("projet");
40 40
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     public $db;
45 45
 
46 46
     public $param;
47
-    public $enabled = 0;		// Disabled because bugged.
47
+    public $enabled = 0; // Disabled because bugged.
48 48
 
49 49
     public $info_box_head = array();
50 50
     public $info_box_contents = array();
@@ -56,17 +56,17 @@  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, $langs;
62 62
 
63 63
         // Load translation files required by the page
64 64
         $langs->loadLangs(array('boxes', 'projects'));
65 65
 
66
-        $this->boxlabel="Tasks";
66
+        $this->boxlabel = "Tasks";
67 67
         $this->db = $db;
68 68
 
69
-        $this->hidden = ! ($user->rights->projet->lire);
69
+        $this->hidden = !($user->rights->projet->lire);
70 70
     }
71 71
 
72 72
 	/**
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 	 *  @param  int     $max        Maximum number of records to load
76 76
 	 *  @return void
77 77
 	 */
78
-	function loadBox($max=5)
78
+	function loadBox($max = 5)
79 79
 	{
80 80
 		global $conf, $user, $langs, $db;
81 81
 
82
-		$this->max=$max;
82
+		$this->max = $max;
83 83
 
84 84
 		$totalMnt = 0;
85 85
 		$totalnb = 0;
86
-		$totalDuree=0;
87
-		$totalplannedtot=0;
88
-		$totaldurationtot=0;
86
+		$totalDuree = 0;
87
+		$totalplannedtot = 0;
88
+		$totaldurationtot = 0;
89 89
 		
90 90
 		include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
91
-		$taskstatic=new Task($db);
91
+		$taskstatic = new Task($db);
92 92
 
93 93
 
94 94
 		$textHead = $langs->trans("Tasks")."&nbsp;".date("Y");
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 		if ($user->rights->projet->lire) {
99 99
 			// FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless.
100 100
 			$sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
101
-			$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
102
-			$sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'";
103
-			$sql.= " AND pt.rowid = ptt.fk_task";
104
-			$sql.= " GROUP BY pt.fk_statut ";
105
-			$sql.= " ORDER BY pt.fk_statut DESC";
106
-			$sql.= $db->plimit($max, 0);
101
+			$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
102
+			$sql .= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'";
103
+			$sql .= " AND pt.rowid = ptt.fk_task";
104
+			$sql .= " GROUP BY pt.fk_statut ";
105
+			$sql .= " ORDER BY pt.fk_statut DESC";
106
+			$sql .= $db->plimit($max, 0);
107 107
 
108 108
 			$result = $db->query($sql);
109 109
 			if ($result)
@@ -115,22 +115,22 @@  discard block
 block discarded – undo
115 115
                     $objp = $db->fetch_object($result);
116 116
                     $this->info_box_contents[$i][] = array(
117 117
                         'td' => '',
118
-                        'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0),
118
+                        'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut, 0),
119 119
                     );
120 120
 
121 121
                     $this->info_box_contents[$i][] = array(
122 122
                         'td' => 'class="right"',
123 123
                         'text' => $objp->nb."&nbsp;".$langs->trans("Tasks"),
124 124
                         //'url' => DOL_URL_ROOT."/projet/tasks/list.php?leftmenu=projects&viewstatut=".$objp->fk_statut,
125
-                        'url' => BASE_URI . "?controller=projet/tasks&method=list&leftmenu=projects&viewstatut=" . $objp->fk_statut,
125
+                        'url' => BASE_URI."?controller=projet/tasks&method=list&leftmenu=projects&viewstatut=".$objp->fk_statut,
126 126
                     );
127 127
 					$totalnb += $objp->nb;
128
-					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5));
128
+					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot, 'all', 25200, 5));
129 129
 					$totalplannedtot += $objp->plannedtot;
130
-					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5));
130
+					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot, 'all', 25200, 5));
131 131
 					$totaldurationtot += $objp->durationtot;
132 132
 
133
-					$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3));
133
+					$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut, 3));
134 134
 
135 135
 					$i++;
136 136
 				}
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 		// Add the sum at the bottom of the boxes
143 143
 		$this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")."&nbsp;".$textHead);
144 144
 		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));
145
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5));
146
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5));
145
+		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot, 'all', 25200, 5));
146
+		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot, 'all', 25200, 5));
147 147
 		$this->info_box_contents[$i][] = array('td' => '', 'text' => "");
148 148
 	}
149 149
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 *  @param	int		$nooutput	No print, only return string
156 156
 	 *	@return	string
157 157
 	 */
158
-	function showBox($head = null, $contents = null, $nooutput=0)
158
+	function showBox($head = null, $contents = null, $nooutput = 0)
159 159
 	{
160 160
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
161 161
 	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_graph_invoices_permonth.php 3 patches
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -28,256 +28,256 @@
 block discarded – undo
28 28
  */
29 29
 class box_graph_invoices_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="invoicespermonth";
32
-	var $boximg="object_bill";
33
-	var $boxlabel="BoxCustomersInvoicesPerMonth";
34
-	var $depends = array("facture");
31
+    var $boxcode="invoicespermonth";
32
+    var $boximg="object_bill";
33
+    var $boxlabel="BoxCustomersInvoicesPerMonth";
34
+    var $depends = array("facture");
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->facture->lire);
58
-	}
57
+        $this->hidden = ! ($user->rights->facture->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;
69
-
70
-		$this->max=$max;
71
-
72
-		$refreshaction='refresh_'.$this->boxcode;
73
-
74
-		//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
75
-		//$facturestatic=new Facture($db);
76
-
77
-		$text = $langs->trans("BoxCustomersInvoicesPerMonth",$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
-
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
-
95
-		if ($user->rights->facture->lire)
96
-		{
97
-			$mesg = '';
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
-
103
-			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104
-			include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.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
-
127
-			$stats = new FactureStats($this->db, $socid, $mode, 0);
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));
133
-
134
-				$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
135
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
136
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$endyear.'.png';
137
-
138
-				$px1 = new DolGraph();
139
-				$mesg = $px1->isGraphKo();
140
-				if (! $mesg)
141
-				{
142
-				    $langs->load("bills");
143
-
144
-				    $px1->SetData($data1);
145
-					unset($data1);
146
-					$px1->SetPrecisionY(0);
147
-					$i=$startyear;$legend=array();
148
-					while ($i <= $endyear)
149
-					{
150
-						$legend[]=$i;
151
-						$i++;
152
-					}
153
-					$px1->SetLegend($legend);
154
-					$px1->SetMaxValue($px1->GetCeilMaxValue());
155
-					$px1->SetWidth($WIDTH);
156
-					$px1->SetHeight($HEIGHT);
157
-					$px1->SetYLabel($langs->trans("NumberOfBills"));
158
-					$px1->SetShading(3);
159
-					$px1->SetHorizTickIncrement(1);
160
-					$px1->SetPrecisionY(0);
161
-					$px1->SetCssPrefix("cssboxes");
162
-					$px1->mode='depth';
163
-					$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
164
-
165
-					$px1->draw($filenamenb,$fileurlnb);
166
-				}
167
-			}
168
-
169
-			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
170
-			if ($showtot)
171
-			{
172
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
173
-
174
-				$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
175
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
176
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$endyear.'.png';
177
-
178
-				$px2 = new DolGraph();
179
-				$mesg = $px2->isGraphKo();
180
-				if (! $mesg)
181
-				{
182
-				    $langs->load("bills");
183
-
184
-					$px2->SetData($data2);
185
-					unset($data2);
186
-					$px2->SetPrecisionY(0);
187
-					$i=$startyear;$legend=array();
188
-					while ($i <= $endyear)
189
-					{
190
-						$legend[]=$i;
191
-						$i++;
192
-					}
193
-					$px2->SetLegend($legend);
194
-					$px2->SetMaxValue($px2->GetCeilMaxValue());
195
-					$px2->SetWidth($WIDTH);
196
-					$px2->SetHeight($HEIGHT);
197
-					$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
198
-					$px2->SetShading(3);
199
-					$px2->SetHorizTickIncrement(1);
200
-					$px2->SetPrecisionY(0);
201
-					$px2->SetCssPrefix("cssboxes");
202
-					$px2->mode='depth';
203
-					$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
204
-
205
-					$px2->draw($filenamenb,$fileurlnb);
206
-				}
207
-			}
208
-
209
-			if (empty($conf->use_javascript_ajax))
210
-			{
211
-				$langs->load("errors");
212
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
213
-			}
214
-
215
-			if (! $mesg)
216
-			{
217
-				$stringtoshow='';
218
-				$stringtoshow.='<script type="text/javascript" language="javascript">
65
+     */
66
+    function loadBox($max=5)
67
+    {
68
+        global $conf, $user, $langs, $db;
69
+
70
+        $this->max=$max;
71
+
72
+        $refreshaction='refresh_'.$this->boxcode;
73
+
74
+        //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
75
+        //$facturestatic=new Facture($db);
76
+
77
+        $text = $langs->trans("BoxCustomersInvoicesPerMonth",$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
+
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
+
95
+        if ($user->rights->facture->lire)
96
+        {
97
+            $mesg = '';
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
+
103
+            include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
104
+            include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.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
+
127
+            $stats = new FactureStats($this->db, $socid, $mode, 0);
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));
133
+
134
+                $filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
135
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
136
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$endyear.'.png';
137
+
138
+                $px1 = new DolGraph();
139
+                $mesg = $px1->isGraphKo();
140
+                if (! $mesg)
141
+                {
142
+                    $langs->load("bills");
143
+
144
+                    $px1->SetData($data1);
145
+                    unset($data1);
146
+                    $px1->SetPrecisionY(0);
147
+                    $i=$startyear;$legend=array();
148
+                    while ($i <= $endyear)
149
+                    {
150
+                        $legend[]=$i;
151
+                        $i++;
152
+                    }
153
+                    $px1->SetLegend($legend);
154
+                    $px1->SetMaxValue($px1->GetCeilMaxValue());
155
+                    $px1->SetWidth($WIDTH);
156
+                    $px1->SetHeight($HEIGHT);
157
+                    $px1->SetYLabel($langs->trans("NumberOfBills"));
158
+                    $px1->SetShading(3);
159
+                    $px1->SetHorizTickIncrement(1);
160
+                    $px1->SetPrecisionY(0);
161
+                    $px1->SetCssPrefix("cssboxes");
162
+                    $px1->mode='depth';
163
+                    $px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
164
+
165
+                    $px1->draw($filenamenb,$fileurlnb);
166
+                }
167
+            }
168
+
169
+            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
170
+            if ($showtot)
171
+            {
172
+                $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
173
+
174
+                $filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
175
+                if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
176
+                if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$endyear.'.png';
177
+
178
+                $px2 = new DolGraph();
179
+                $mesg = $px2->isGraphKo();
180
+                if (! $mesg)
181
+                {
182
+                    $langs->load("bills");
183
+
184
+                    $px2->SetData($data2);
185
+                    unset($data2);
186
+                    $px2->SetPrecisionY(0);
187
+                    $i=$startyear;$legend=array();
188
+                    while ($i <= $endyear)
189
+                    {
190
+                        $legend[]=$i;
191
+                        $i++;
192
+                    }
193
+                    $px2->SetLegend($legend);
194
+                    $px2->SetMaxValue($px2->GetCeilMaxValue());
195
+                    $px2->SetWidth($WIDTH);
196
+                    $px2->SetHeight($HEIGHT);
197
+                    $px2->SetYLabel($langs->trans("AmountOfBillsHT"));
198
+                    $px2->SetShading(3);
199
+                    $px2->SetHorizTickIncrement(1);
200
+                    $px2->SetPrecisionY(0);
201
+                    $px2->SetCssPrefix("cssboxes");
202
+                    $px2->mode='depth';
203
+                    $px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
204
+
205
+                    $px2->draw($filenamenb,$fileurlnb);
206
+                }
207
+            }
208
+
209
+            if (empty($conf->use_javascript_ajax))
210
+            {
211
+                $langs->load("errors");
212
+                $mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
213
+            }
214
+
215
+            if (! $mesg)
216
+            {
217
+                $stringtoshow='';
218
+                $stringtoshow.='<script type="text/javascript" language="javascript">
219 219
 					jQuery(document).ready(function() {
220 220
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
221 221
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
222 222
 						});
223 223
 					});
224 224
 					</script>';
225
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
226
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
227
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
228
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
229
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
230
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
231
-				$stringtoshow.=' &nbsp; ';
232
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
233
-				$stringtoshow.='<br>';
234
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
235
-				$stringtoshow.='<input class="reposition inline-block valigntextbottom" type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
236
-				$stringtoshow.='</form>';
237
-				$stringtoshow.='</div>';
238
-				if ($shownb && $showtot)
239
-				{
240
-					$stringtoshow.='<div class="fichecenter">';
241
-					$stringtoshow.='<div class="fichehalfleft">';
242
-				}
243
-				if ($shownb) $stringtoshow.=$px1->show();
244
-				if ($shownb && $showtot)
245
-				{
246
-					$stringtoshow.='</div>';
247
-					$stringtoshow.='<div class="fichehalfright">';
248
-				}
249
-				if ($showtot) $stringtoshow.=$px2->show();
250
-				if ($shownb && $showtot)
251
-				{
252
-					$stringtoshow.='</div>';
253
-					$stringtoshow.='</div>';
254
-				}
255
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
256
-			}
257
-			else
258
-			{
259
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"', 'maxlength'=>500, 'text' => $mesg);
260
-			}
261
-		}
262
-		else {
263
-			$this->info_box_contents[0][0] = array(
264
-			    'td' => 'align="left" class="nohover opacitymedium"',
225
+                $stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
226
+                $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
227
+                $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
228
+                $stringtoshow.='<input type="hidden" name="page_y" value="">';
229
+                $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
230
+                $stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
231
+                $stringtoshow.=' &nbsp; ';
232
+                $stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
233
+                $stringtoshow.='<br>';
234
+                $stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
235
+                $stringtoshow.='<input class="reposition inline-block valigntextbottom" type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
236
+                $stringtoshow.='</form>';
237
+                $stringtoshow.='</div>';
238
+                if ($shownb && $showtot)
239
+                {
240
+                    $stringtoshow.='<div class="fichecenter">';
241
+                    $stringtoshow.='<div class="fichehalfleft">';
242
+                }
243
+                if ($shownb) $stringtoshow.=$px1->show();
244
+                if ($shownb && $showtot)
245
+                {
246
+                    $stringtoshow.='</div>';
247
+                    $stringtoshow.='<div class="fichehalfright">';
248
+                }
249
+                if ($showtot) $stringtoshow.=$px2->show();
250
+                if ($shownb && $showtot)
251
+                {
252
+                    $stringtoshow.='</div>';
253
+                    $stringtoshow.='</div>';
254
+                }
255
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
256
+            }
257
+            else
258
+            {
259
+                $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"', 'maxlength'=>500, 'text' => $mesg);
260
+            }
261
+        }
262
+        else {
263
+            $this->info_box_contents[0][0] = array(
264
+                'td' => 'align="left" class="nohover opacitymedium"',
265 265
                 'text' => $langs->trans("ReadPermissionNotAllowed")
266
-			);
267
-		}
268
-	}
269
-
270
-	/**
271
-	 *	Method to show box
272
-	 *
273
-	 *	@param	array	$head       Array with properties of box title
274
-	 *	@param  array	$contents   Array with properties of box lines
275
-	 *  @param	int		$nooutput	No print, only return string
276
-	 *	@return	string
277
-	 */
266
+            );
267
+        }
268
+    }
269
+
270
+    /**
271
+     *	Method to show box
272
+     *
273
+     *	@param	array	$head       Array with properties of box title
274
+     *	@param  array	$contents   Array with properties of box lines
275
+     *  @param	int		$nooutput	No print, only return string
276
+     *	@return	string
277
+     */
278 278
     function showBox($head = null, $contents = null, $nooutput=0)
279 279
     {
280
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
281
-	}
280
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
281
+    }
282 282
 }
283 283
 
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class box_graph_invoices_permonth extends ModeleBoxes
30 30
 {
31
-	var $boxcode="invoicespermonth";
32
-	var $boximg="object_bill";
33
-	var $boxlabel="BoxCustomersInvoicesPerMonth";
31
+	var $boxcode = "invoicespermonth";
32
+	var $boximg = "object_bill";
33
+	var $boxlabel = "BoxCustomersInvoicesPerMonth";
34 34
 	var $depends = array("facture");
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->facture->lire);
57
+		$this->hidden = !($user->rights->facture->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.'/compta/facture/class/facture.class.php';
75 75
 		//$facturestatic=new Facture($db);
76 76
 
77
-		$text = $langs->trans("BoxCustomersInvoicesPerMonth",$max);
77
+		$text = $langs->trans("BoxCustomersInvoicesPerMonth", $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->facture->lire)
96 96
 		{
97 97
 			$mesg = '';
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.'/compta/facture/class/facturestats.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 FactureStats($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."invoicesnbinyear-".$endyear.".png";
135 135
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
@@ -137,17 +137,17 @@  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
 				    $langs->load("bills");
143 143
 
144 144
 				    $px1->SetData($data1);
145 145
 					unset($data1);
146 146
 					$px1->SetPrecisionY(0);
147
-					$i=$startyear;$legend=array();
147
+					$i = $startyear; $legend = array();
148 148
 					while ($i <= $endyear)
149 149
 					{
150
-						$legend[]=$i;
150
+						$legend[] = $i;
151 151
 						$i++;
152 152
 					}
153 153
 					$px1->SetLegend($legend);
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 					$px1->SetHorizTickIncrement(1);
160 160
 					$px1->SetPrecisionY(0);
161 161
 					$px1->SetCssPrefix("cssboxes");
162
-					$px1->mode='depth';
162
+					$px1->mode = 'depth';
163 163
 					$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
164 164
 
165
-					$px1->draw($filenamenb,$fileurlnb);
165
+					$px1->draw($filenamenb, $fileurlnb);
166 166
 				}
167 167
 			}
168 168
 
169 169
 			// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
170 170
 			if ($showtot)
171 171
 			{
172
-				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
172
+				$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0));
173 173
 
174 174
 				$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
175 175
 				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
@@ -177,17 +177,17 @@  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
 				    $langs->load("bills");
183 183
 
184 184
 					$px2->SetData($data2);
185 185
 					unset($data2);
186 186
 					$px2->SetPrecisionY(0);
187
-					$i=$startyear;$legend=array();
187
+					$i = $startyear; $legend = array();
188 188
 					while ($i <= $endyear)
189 189
 					{
190
-						$legend[]=$i;
190
+						$legend[] = $i;
191 191
 						$i++;
192 192
 					}
193 193
 					$px2->SetLegend($legend);
@@ -199,60 +199,60 @@  discard block
 block discarded – undo
199 199
 					$px2->SetHorizTickIncrement(1);
200 200
 					$px2->SetPrecisionY(0);
201 201
 					$px2->SetCssPrefix("cssboxes");
202
-					$px2->mode='depth';
202
+					$px2->mode = 'depth';
203 203
 					$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
204 204
 
205
-					$px2->draw($filenamenb,$fileurlnb);
205
+					$px2->draw($filenamenb, $fileurlnb);
206 206
 				}
207 207
 			}
208 208
 
209 209
 			if (empty($conf->use_javascript_ajax))
210 210
 			{
211 211
 				$langs->load("errors");
212
-				$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
212
+				$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
213 213
 			}
214 214
 
215
-			if (! $mesg)
215
+			if (!$mesg)
216 216
 			{
217
-				$stringtoshow='';
218
-				$stringtoshow.='<script type="text/javascript" language="javascript">
217
+				$stringtoshow = '';
218
+				$stringtoshow .= '<script type="text/javascript" language="javascript">
219 219
 					jQuery(document).ready(function() {
220 220
 						jQuery("#idsubimg'.$this->boxcode.'").click(function() {
221 221
 							jQuery("#idfilter'.$this->boxcode.'").toggle();
222 222
 						});
223 223
 					});
224 224
 					</script>';
225
-				$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';	// hideobject is to start hidden
226
-				$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
227
-				$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
228
-				$stringtoshow.='<input type="hidden" name="page_y" value="">';
229
-				$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
230
-				$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
231
-				$stringtoshow.=' &nbsp; ';
232
-				$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
233
-				$stringtoshow.='<br>';
234
-				$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
235
-				$stringtoshow.='<input class="reposition inline-block valigntextbottom" type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
236
-				$stringtoshow.='</form>';
237
-				$stringtoshow.='</div>';
225
+				$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
226
+				$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
227
+				$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
228
+				$stringtoshow .= '<input type="hidden" name="page_y" value="">';
229
+				$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
230
+				$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfBillsByMonth");
231
+				$stringtoshow .= ' &nbsp; ';
232
+				$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfBillsByMonthHT");
233
+				$stringtoshow .= '<br>';
234
+				$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
235
+				$stringtoshow .= '<input class="reposition inline-block valigntextbottom" type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
236
+				$stringtoshow .= '</form>';
237
+				$stringtoshow .= '</div>';
238 238
 				if ($shownb && $showtot)
239 239
 				{
240
-					$stringtoshow.='<div class="fichecenter">';
241
-					$stringtoshow.='<div class="fichehalfleft">';
240
+					$stringtoshow .= '<div class="fichecenter">';
241
+					$stringtoshow .= '<div class="fichehalfleft">';
242 242
 				}
243
-				if ($shownb) $stringtoshow.=$px1->show();
243
+				if ($shownb) $stringtoshow .= $px1->show();
244 244
 				if ($shownb && $showtot)
245 245
 				{
246
-					$stringtoshow.='</div>';
247
-					$stringtoshow.='<div class="fichehalfright">';
246
+					$stringtoshow .= '</div>';
247
+					$stringtoshow .= '<div class="fichehalfright">';
248 248
 				}
249
-				if ($showtot) $stringtoshow.=$px2->show();
249
+				if ($showtot) $stringtoshow .= $px2->show();
250 250
 				if ($shownb && $showtot)
251 251
 				{
252
-					$stringtoshow.='</div>';
253
-					$stringtoshow.='</div>';
252
+					$stringtoshow .= '</div>';
253
+					$stringtoshow .= '</div>';
254 254
 				}
255
-				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
255
+				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"', 'textnoformat'=>$stringtoshow);
256 256
 			}
257 257
 			else
258 258
 			{
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 *  @param	int		$nooutput	No print, only return string
276 276
 	 *	@return	string
277 277
 	 */
278
-    function showBox($head = null, $contents = null, $nooutput=0)
278
+    function showBox($head = null, $contents = null, $nooutput = 0)
279 279
     {
280 280
 		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
281 281
 	}
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->facture->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."invoicesnbinyear-".$endyear.".png";
135
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
136
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$endyear.'.png';
141
+				if ($mode == 'customer') {
142
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
143
+				}
144
+				if ($mode == 'supplier') {
145
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$endyear.'.png';
146
+				}
137 147
 
138 148
 				$px1 = new DolGraph();
139 149
 				$mesg = $px1->isGraphKo();
@@ -172,8 +182,12 @@  discard block
 block discarded – undo
172 182
 				$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
173 183
 
174 184
 				$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
175
-				if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
176
-				if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$endyear.'.png';
185
+				if ($mode == 'customer') {
186
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
187
+				}
188
+				if ($mode == 'supplier') {
189
+				    $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$endyear.'.png';
190
+				}
177 191
 
178 192
 				$px2 = new DolGraph();
179 193
 				$mesg = $px2->isGraphKo();
@@ -240,26 +254,28 @@  discard block
 block discarded – undo
240 254
 					$stringtoshow.='<div class="fichecenter">';
241 255
 					$stringtoshow.='<div class="fichehalfleft">';
242 256
 				}
243
-				if ($shownb) $stringtoshow.=$px1->show();
257
+				if ($shownb) {
258
+				    $stringtoshow.=$px1->show();
259
+				}
244 260
 				if ($shownb && $showtot)
245 261
 				{
246 262
 					$stringtoshow.='</div>';
247 263
 					$stringtoshow.='<div class="fichehalfright">';
248 264
 				}
249
-				if ($showtot) $stringtoshow.=$px2->show();
265
+				if ($showtot) {
266
+				    $stringtoshow.=$px2->show();
267
+				}
250 268
 				if ($shownb && $showtot)
251 269
 				{
252 270
 					$stringtoshow.='</div>';
253 271
 					$stringtoshow.='</div>';
254 272
 				}
255 273
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
256
-			}
257
-			else
274
+			} else
258 275
 			{
259 276
 				$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"', 'maxlength'=>500, 'text' => $mesg);
260 277
 			}
261
-		}
262
-		else {
278
+		} else {
263 279
 			$this->info_box_contents[0][0] = array(
264 280
 			    'td' => 'align="left" class="nohover opacitymedium"',
265 281
                 'text' => $langs->trans("ReadPermissionNotAllowed")
Please login to merge, or discard this patch.
dolibarr/htdocs/core/get_menudiv.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 
177 177
 if (empty($user->societe_id))	// If internal user or not defined
178 178
 {
179
-	$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
179
+    $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
180 180
 }
181 181
 else                        	// If external user
182 182
 {
183
-	$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
183
+    $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
184 184
 }
185 185
 
186 186
 // Load the menu manager (only if not already done)
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 if (GETPOST('menu')) $file_menu=GETPOST('menu');     // example: menu=eldy_menu.php
189 189
 if (! class_exists('MenuManager'))
190 190
 {
191
-	$menufound=0;
192
-	$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
193
-	foreach($dirmenus as $dirmenu)
194
-	{
195
-		$menufound=dol_include_once($dirmenu."standard/".$file_menu);
196
-		if ($menufound) break;
197
-	}
198
-	if (! $menufound)	// If failed to include, we try with standard
199
-	{
200
-		dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
201
-		$file_menu='eldy_menu.php';
202
-		include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
203
-	}
191
+    $menufound=0;
192
+    $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
193
+    foreach($dirmenus as $dirmenu)
194
+    {
195
+        $menufound=dol_include_once($dirmenu."standard/".$file_menu);
196
+        if ($menufound) break;
197
+    }
198
+    if (! $menufound)	// If failed to include, we try with standard
199
+    {
200
+        dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
201
+        $file_menu='eldy_menu.php';
202
+        include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
203
+    }
204 204
 }
205 205
 $menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
206 206
 $menumanager->loadMenu('all','all');	// Load this->tabMenu with sql menu entries
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -27,40 +27,40 @@  discard block
 block discarded – undo
27 27
 //if (! defined('NOREQUIREDB'))   define('NOREQUIREDB','1');		// Not disabled cause need to load personalized language
28 28
 //if (! defined('NOREQUIRESOC'))    define('NOREQUIRESOC','1');
29 29
 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');		// Not disabled cause need to do translations
30
-if (! defined('NOCSRFCHECK'))     define('NOCSRFCHECK',1);
31
-if (! defined('NOTOKENRENEWAL'))  define('NOTOKENRENEWAL',1);
30
+if (!defined('NOCSRFCHECK'))     define('NOCSRFCHECK', 1);
31
+if (!defined('NOTOKENRENEWAL'))  define('NOTOKENRENEWAL', 1);
32 32
 //if (! defined('NOLOGIN')) define('NOLOGIN',1);					// Not disabled cause need to load personalized language
33
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU',1);
34
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML',1);
35
-
36
-if (! defined('DISABLE_JQUERY_TABLEDND'))   define('DISABLE_JQUERY_TABLEDND',1);
37
-if (! defined('DISABLE_JQUERY_JNOTIFY'))    define('DISABLE_JQUERY_JNOTIFY',1);
38
-if (! defined('DISABLE_JQUERY_FLOT'))       define('DISABLE_JQUERY_FLOT',1);
39
-if (! defined('DISABLE_JQUERY_JEDITABLE'))  define('DISABLE_JQUERY_JEDITABLE',1);
40
-if (! defined('DISABLE_CKEDITOR'))          define('DISABLE_CKEDITOR',1);
41
-if (! defined('DISABLE_BROWSER_NOTIF'))     define('DISABLE_BROWSER_NOTIF',1);
42
-if (! defined('DISABLE_DATE_PICKER'))       define('DISABLE_DATE_PICKER',1);
43
-if (! defined('DISABLE_SELECT2'))           define('DISABLE_SELECT2',1);
33
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', 1);
34
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', 1);
35
+
36
+if (!defined('DISABLE_JQUERY_TABLEDND'))   define('DISABLE_JQUERY_TABLEDND', 1);
37
+if (!defined('DISABLE_JQUERY_JNOTIFY'))    define('DISABLE_JQUERY_JNOTIFY', 1);
38
+if (!defined('DISABLE_JQUERY_FLOT'))       define('DISABLE_JQUERY_FLOT', 1);
39
+if (!defined('DISABLE_JQUERY_JEDITABLE'))  define('DISABLE_JQUERY_JEDITABLE', 1);
40
+if (!defined('DISABLE_CKEDITOR'))          define('DISABLE_CKEDITOR', 1);
41
+if (!defined('DISABLE_BROWSER_NOTIF'))     define('DISABLE_BROWSER_NOTIF', 1);
42
+if (!defined('DISABLE_DATE_PICKER'))       define('DISABLE_DATE_PICKER', 1);
43
+if (!defined('DISABLE_SELECT2'))           define('DISABLE_SELECT2', 1);
44 44
 
45 45
 require_once '../main.inc.php';
46 46
 
47
-if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));	// If language was forced on URL by the main.inc.php
47
+if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
48 48
 
49 49
 $langs->load("main");
50
-$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
51
-$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
50
+$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
51
+$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
52 52
 
53 53
 
54 54
 /*
55 55
  * View
56 56
  */
57 57
 
58
-$title=$langs->trans("Menu");
58
+$title = $langs->trans("Menu");
59 59
 
60 60
 // URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests
61
-$head='<!-- Menu -->'."\n";
62
-$arrayofjs=array();
63
-$arrayofcss=array();
61
+$head = '<!-- Menu -->'."\n";
62
+$arrayofjs = array();
63
+$arrayofcss = array();
64 64
 top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
65 65
 
66 66
 print '<body>'."\n";
@@ -176,34 +176,34 @@  discard block
 block discarded – undo
176 176
 
177 177
 if (empty($user->societe_id))	// If internal user or not defined
178 178
 {
179
-	$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
179
+	$conf->standard_menu = (empty($conf->global->MAIN_MENU_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENU_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED);
180 180
 }
181 181
 else                        	// If external user
182 182
 {
183
-	$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
183
+	$conf->standard_menu = (empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENUFRONT_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
184 184
 }
185 185
 
186 186
 // Load the menu manager (only if not already done)
187
-$file_menu=$conf->standard_menu;
188
-if (GETPOST('menu')) $file_menu=GETPOST('menu');     // example: menu=eldy_menu.php
189
-if (! class_exists('MenuManager'))
187
+$file_menu = $conf->standard_menu;
188
+if (GETPOST('menu')) $file_menu = GETPOST('menu'); // example: menu=eldy_menu.php
189
+if (!class_exists('MenuManager'))
190 190
 {
191
-	$menufound=0;
192
-	$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
193
-	foreach($dirmenus as $dirmenu)
191
+	$menufound = 0;
192
+	$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
193
+	foreach ($dirmenus as $dirmenu)
194 194
 	{
195
-		$menufound=dol_include_once($dirmenu."standard/".$file_menu);
195
+		$menufound = dol_include_once($dirmenu."standard/".$file_menu);
196 196
 		if ($menufound) break;
197 197
 	}
198
-	if (! $menufound)	// If failed to include, we try with standard
198
+	if (!$menufound)	// If failed to include, we try with standard
199 199
 	{
200 200
 		dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
201
-		$file_menu='eldy_menu.php';
201
+		$file_menu = 'eldy_menu.php';
202 202
 		include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
203 203
 	}
204 204
 }
205
-$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
206
-$menumanager->loadMenu('all','all');	// Load this->tabMenu with sql menu entries
205
+$menumanager = new MenuManager($db, empty($user->societe_id) ? 0 : 1);
206
+$menumanager->loadMenu('all', 'all'); // Load this->tabMenu with sql menu entries
207 207
 //var_dump($menumanager);exit;
208 208
 $menumanager->showmenu('jmobile');
209 209
 
Please login to merge, or discard this patch.
Braces   +54 added lines, -19 removed lines patch added patch discarded remove patch
@@ -27,24 +27,51 @@  discard block
 block discarded – undo
27 27
 //if (! defined('NOREQUIREDB'))   define('NOREQUIREDB','1');		// Not disabled cause need to load personalized language
28 28
 //if (! defined('NOREQUIRESOC'))    define('NOREQUIRESOC','1');
29 29
 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');		// Not disabled cause need to do translations
30
-if (! defined('NOCSRFCHECK'))     define('NOCSRFCHECK',1);
31
-if (! defined('NOTOKENRENEWAL'))  define('NOTOKENRENEWAL',1);
30
+if (! defined('NOCSRFCHECK')) {
31
+    define('NOCSRFCHECK',1);
32
+}
33
+if (! defined('NOTOKENRENEWAL')) {
34
+    define('NOTOKENRENEWAL',1);
35
+}
32 36
 //if (! defined('NOLOGIN')) define('NOLOGIN',1);					// Not disabled cause need to load personalized language
33
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU',1);
34
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML',1);
35
-
36
-if (! defined('DISABLE_JQUERY_TABLEDND'))   define('DISABLE_JQUERY_TABLEDND',1);
37
-if (! defined('DISABLE_JQUERY_JNOTIFY'))    define('DISABLE_JQUERY_JNOTIFY',1);
38
-if (! defined('DISABLE_JQUERY_FLOT'))       define('DISABLE_JQUERY_FLOT',1);
39
-if (! defined('DISABLE_JQUERY_JEDITABLE'))  define('DISABLE_JQUERY_JEDITABLE',1);
40
-if (! defined('DISABLE_CKEDITOR'))          define('DISABLE_CKEDITOR',1);
41
-if (! defined('DISABLE_BROWSER_NOTIF'))     define('DISABLE_BROWSER_NOTIF',1);
42
-if (! defined('DISABLE_DATE_PICKER'))       define('DISABLE_DATE_PICKER',1);
43
-if (! defined('DISABLE_SELECT2'))           define('DISABLE_SELECT2',1);
37
+if (! defined('NOREQUIREMENU')) {
38
+    define('NOREQUIREMENU',1);
39
+}
40
+if (! defined('NOREQUIREHTML')) {
41
+    define('NOREQUIREHTML',1);
42
+}
43
+
44
+if (! defined('DISABLE_JQUERY_TABLEDND')) {
45
+    define('DISABLE_JQUERY_TABLEDND',1);
46
+}
47
+if (! defined('DISABLE_JQUERY_JNOTIFY')) {
48
+    define('DISABLE_JQUERY_JNOTIFY',1);
49
+}
50
+if (! defined('DISABLE_JQUERY_FLOT')) {
51
+    define('DISABLE_JQUERY_FLOT',1);
52
+}
53
+if (! defined('DISABLE_JQUERY_JEDITABLE')) {
54
+    define('DISABLE_JQUERY_JEDITABLE',1);
55
+}
56
+if (! defined('DISABLE_CKEDITOR')) {
57
+    define('DISABLE_CKEDITOR',1);
58
+}
59
+if (! defined('DISABLE_BROWSER_NOTIF')) {
60
+    define('DISABLE_BROWSER_NOTIF',1);
61
+}
62
+if (! defined('DISABLE_DATE_PICKER')) {
63
+    define('DISABLE_DATE_PICKER',1);
64
+}
65
+if (! defined('DISABLE_SELECT2')) {
66
+    define('DISABLE_SELECT2',1);
67
+}
44 68
 
45 69
 require_once '../main.inc.php';
46 70
 
47
-if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));	// If language was forced on URL by the main.inc.php
71
+if (GETPOST('lang', 'aZ09')) {
72
+    $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
73
+}
74
+// If language was forced on URL by the main.inc.php
48 75
 
49 76
 $langs->load("main");
50 77
 $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
@@ -174,18 +201,22 @@  discard block
 block discarded – undo
174 201
 ';
175 202
 
176 203
 
177
-if (empty($user->societe_id))	// If internal user or not defined
204
+if (empty($user->societe_id)) {
205
+    // If internal user or not defined
178 206
 {
179 207
 	$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
180 208
 }
181
-else                        	// If external user
209
+} else                        	// If external user
182 210
 {
183 211
 	$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
184 212
 }
185 213
 
186 214
 // Load the menu manager (only if not already done)
187 215
 $file_menu=$conf->standard_menu;
188
-if (GETPOST('menu')) $file_menu=GETPOST('menu');     // example: menu=eldy_menu.php
216
+if (GETPOST('menu')) {
217
+    $file_menu=GETPOST('menu');
218
+}
219
+// example: menu=eldy_menu.php
189 220
 if (! class_exists('MenuManager'))
190 221
 {
191 222
 	$menufound=0;
@@ -193,11 +224,15 @@  discard block
 block discarded – undo
193 224
 	foreach($dirmenus as $dirmenu)
194 225
 	{
195 226
 		$menufound=dol_include_once($dirmenu."standard/".$file_menu);
196
-		if ($menufound) break;
227
+		if ($menufound) {
228
+		    break;
229
+		}
197 230
 	}
198
-	if (! $menufound)	// If failed to include, we try with standard
231
+	if (! $menufound) {
232
+	    // If failed to include, we try with standard
199 233
 	{
200 234
 		dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
235
+	}
201 236
 		$file_menu='eldy_menu.php';
202 237
 		include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
203 238
 	}
Please login to merge, or discard this patch.