@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | // Entries must be declared in modules descriptor with line |
43 | 43 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
44 | 44 | // $this->tabs = array('entity:-tabname); to remove a tab |
45 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment'); |
|
45 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment'); |
|
46 | 46 | |
47 | 47 | $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; |
48 | 48 | $head[$h][1] = $langs->trans("Info"); |
49 | 49 | $head[$h][2] = 'info'; |
50 | 50 | $h++; |
51 | 51 | |
52 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); |
|
52 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove'); |
|
53 | 53 | |
54 | 54 | return $head; |
55 | 55 | } |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | // Entries must be declared in modules descriptor with line |
78 | 78 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
79 | 79 | // $this->tabs = array('entity:-tabname); to remove a tab |
80 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier'); |
|
80 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier'); |
|
81 | 81 | |
82 | 82 | $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; |
83 | 83 | $head[$h][1] = $langs->trans('Info'); |
84 | 84 | $head[$h][2] = 'info'; |
85 | 85 | $h++; |
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); |
|
87 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier', 'remove'); |
|
88 | 88 | |
89 | 89 | return $head; |
90 | 90 | } |
@@ -95,23 +95,23 @@ discard block |
||
95 | 95 | * @param string $paymentmethod Filter on this payment method (''=none, 'paypal', ...) |
96 | 96 | * @return array Array of valid payment method |
97 | 97 | */ |
98 | -function getValidOnlinePaymentMethods($paymentmethod='') |
|
98 | +function getValidOnlinePaymentMethods($paymentmethod = '') |
|
99 | 99 | { |
100 | 100 | global $conf; |
101 | 101 | |
102 | - $validpaymentmethod=array(); |
|
102 | + $validpaymentmethod = array(); |
|
103 | 103 | |
104 | - if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) |
|
104 | + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) |
|
105 | 105 | { |
106 | - $validpaymentmethod['paypal']='valid'; |
|
106 | + $validpaymentmethod['paypal'] = 'valid'; |
|
107 | 107 | } |
108 | - if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) |
|
108 | + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) |
|
109 | 109 | { |
110 | - $validpaymentmethod['paybox']='valid'; |
|
110 | + $validpaymentmethod['paybox'] = 'valid'; |
|
111 | 111 | } |
112 | - if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) |
|
112 | + if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) |
|
113 | 113 | { |
114 | - $validpaymentmethod['stripe']='valid'; |
|
114 | + $validpaymentmethod['stripe'] = 'valid'; |
|
115 | 115 | } |
116 | 116 | return $validpaymentmethod; |
117 | 117 | } |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | * @param string $ref Ref of object |
124 | 124 | * @return string Url string |
125 | 125 | */ |
126 | -function showOnlinePaymentUrl($type,$ref) |
|
126 | +function showOnlinePaymentUrl($type, $ref) |
|
127 | 127 | { |
128 | 128 | global $conf, $langs; |
129 | 129 | |
130 | 130 | // Load translation files required by the page |
131 | 131 | $langs->loadLangs(array('payment', 'paybox')); |
132 | 132 | |
133 | - $servicename='Online'; |
|
133 | + $servicename = 'Online'; |
|
134 | 134 | |
135 | - $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>'; |
|
136 | - $url = getOnlinePaymentUrl(0,$type,$ref); |
|
137 | - $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | - $out.= ajax_autoselect("onlinepaymenturl", 0); |
|
135 | + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>'; |
|
136 | + $url = getOnlinePaymentUrl(0, $type, $ref); |
|
137 | + $out .= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | + $out .= ajax_autoselect("onlinepaymenturl", 0); |
|
139 | 139 | return $out; |
140 | 140 | } |
141 | 141 | |
@@ -149,115 +149,115 @@ discard block |
||
149 | 149 | * @param string $freetag Free tag |
150 | 150 | * @return string Url string |
151 | 151 | */ |
152 | -function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag') |
|
152 | +function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag') |
|
153 | 153 | { |
154 | 154 | global $conf; |
155 | 155 | |
156 | - $ref=str_replace(' ','',$ref); |
|
157 | - $out=''; |
|
156 | + $ref = str_replace(' ', '', $ref); |
|
157 | + $out = ''; |
|
158 | 158 | |
159 | 159 | if ($type == 'free') |
160 | 160 | { |
161 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
|
162 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
161 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : ''); |
|
162 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
163 | 163 | { |
164 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | - else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
164 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | + else $out .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | elseif ($type == 'order') |
169 | 169 | { |
170 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
|
171 | - if ($mode == 1) $out.='order_ref'; |
|
172 | - if ($mode == 0) $out.=urlencode($ref); |
|
173 | - $out.=($mode?'</font>':''); |
|
174 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
170 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : ''); |
|
171 | + if ($mode == 1) $out .= 'order_ref'; |
|
172 | + if ($mode == 0) $out .= urlencode($ref); |
|
173 | + $out .= ($mode ? '</font>' : ''); |
|
174 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
175 | 175 | { |
176 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
176 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | 177 | else |
178 | 178 | { |
179 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
180 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
182 | - $out.=($mode?'</font>':''); |
|
179 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
180 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
182 | + $out .= ($mode ? '</font>' : ''); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | elseif ($type == 'invoice') |
187 | 187 | { |
188 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
|
189 | - if ($mode == 1) $out.='invoice_ref'; |
|
190 | - if ($mode == 0) $out.=urlencode($ref); |
|
191 | - $out.=($mode?'</font>':''); |
|
192 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
188 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : ''); |
|
189 | + if ($mode == 1) $out .= 'invoice_ref'; |
|
190 | + if ($mode == 0) $out .= urlencode($ref); |
|
191 | + $out .= ($mode ? '</font>' : ''); |
|
192 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
193 | 193 | { |
194 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
194 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | 195 | else |
196 | 196 | { |
197 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
198 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
200 | - $out.=($mode?'</font>':''); |
|
197 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
198 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
200 | + $out .= ($mode ? '</font>' : ''); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
204 | 204 | elseif ($type == 'contractline') |
205 | 205 | { |
206 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
|
207 | - if ($mode == 1) $out.='contractline_ref'; |
|
208 | - if ($mode == 0) $out.=urlencode($ref); |
|
209 | - $out.=($mode?'</font>':''); |
|
210 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
206 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : ''); |
|
207 | + if ($mode == 1) $out .= 'contractline_ref'; |
|
208 | + if ($mode == 0) $out .= urlencode($ref); |
|
209 | + $out .= ($mode ? '</font>' : ''); |
|
210 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
211 | 211 | { |
212 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
212 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | 213 | else |
214 | 214 | { |
215 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
216 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | - $out.=($mode?'</font>':''); |
|
215 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
216 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
218 | + $out .= ($mode ? '</font>' : ''); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | } |
222 | 222 | elseif ($type == 'member' || $type == 'membersubscription') |
223 | 223 | { |
224 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
|
225 | - if ($mode == 1) $out.='member_ref'; |
|
226 | - if ($mode == 0) $out.=urlencode($ref); |
|
227 | - $out.=($mode?'</font>':''); |
|
228 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
224 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : ''); |
|
225 | + if ($mode == 1) $out .= 'member_ref'; |
|
226 | + if ($mode == 0) $out .= urlencode($ref); |
|
227 | + $out .= ($mode ? '</font>' : ''); |
|
228 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
229 | 229 | { |
230 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
230 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | 231 | else |
232 | 232 | { |
233 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
234 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
236 | - $out.=($mode?'</font>':''); |
|
233 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
234 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
236 | + $out .= ($mode ? '</font>' : ''); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
240 | 240 | if ($type == 'donation') |
241 | 241 | { |
242 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
|
243 | - if ($mode == 1) $out.='donation_ref'; |
|
244 | - if ($mode == 0) $out.=urlencode($ref); |
|
245 | - $out.=($mode?'</font>':''); |
|
246 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
242 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<font color="#666666">' : ''); |
|
243 | + if ($mode == 1) $out .= 'donation_ref'; |
|
244 | + if ($mode == 0) $out .= urlencode($ref); |
|
245 | + $out .= ($mode ? '</font>' : ''); |
|
246 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
247 | 247 | { |
248 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
248 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | 249 | else |
250 | 250 | { |
251 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
252 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
254 | - $out.=($mode?'</font>':''); |
|
251 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
252 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
254 | + $out .= ($mode ? '</font>' : ''); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | 259 | // For multicompany |
260 | - if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
260 | + if (!empty($out) && !empty($conf->multicompany->enabled)) $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
261 | 261 | |
262 | 262 | return $out; |
263 | 263 | } |
@@ -274,56 +274,56 @@ discard block |
||
274 | 274 | * @param Object $object Object related to payment |
275 | 275 | * @return void |
276 | 276 | */ |
277 | -function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null) |
|
277 | +function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null) |
|
278 | 278 | { |
279 | 279 | global $conf; |
280 | 280 | |
281 | 281 | // Juridical status |
282 | - $line1=""; |
|
282 | + $line1 = ""; |
|
283 | 283 | if ($fromcompany->forme_juridique_code) |
284 | 284 | { |
285 | - $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); |
|
285 | + $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); |
|
286 | 286 | } |
287 | 287 | // Capital |
288 | 288 | if ($fromcompany->capital) |
289 | 289 | { |
290 | - $line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); |
|
290 | + $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); |
|
291 | 291 | } |
292 | 292 | // Prof Id 1 |
293 | - if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) |
|
293 | + if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) |
|
294 | 294 | { |
295 | - $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code); |
|
296 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
297 | - $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1; |
|
295 | + $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code); |
|
296 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
297 | + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1; |
|
298 | 298 | } |
299 | 299 | // Prof Id 2 |
300 | 300 | if ($fromcompany->idprof2) |
301 | 301 | { |
302 | - $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code); |
|
303 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
304 | - $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2; |
|
302 | + $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code); |
|
303 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
304 | + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | // Second line of company infos |
308 | - $line2=""; |
|
308 | + $line2 = ""; |
|
309 | 309 | // Prof Id 3 |
310 | 310 | if ($fromcompany->idprof3) |
311 | 311 | { |
312 | - $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code); |
|
313 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
314 | - $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3; |
|
312 | + $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code); |
|
313 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
314 | + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3; |
|
315 | 315 | } |
316 | 316 | // Prof Id 4 |
317 | 317 | if ($fromcompany->idprof4) |
318 | 318 | { |
319 | - $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code); |
|
320 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
321 | - $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4; |
|
319 | + $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code); |
|
320 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
321 | + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4; |
|
322 | 322 | } |
323 | 323 | // IntraCommunautary VAT |
324 | 324 | if ($fromcompany->tva_intra != '') |
325 | 325 | { |
326 | - $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; |
|
326 | + $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | print '<br>'; |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | print '<!-- object = '.$object->element.' -->'; |
335 | 335 | print '<br>'; |
336 | 336 | |
337 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
337 | + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | + if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | + elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
340 | 340 | |
341 | 341 | // Add other message if VAT exists |
342 | 342 | if ($object->total_vat != 0 || $object->total_tva != 0) |
343 | 343 | { |
344 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
344 | + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | + if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | + elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $h = 0; |
36 | 36 | $head = array(); |
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php'; |
|
38 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/setup.php'; |
|
39 | 39 | $head[$h][1] = $langs->trans("Settings"); |
40 | 40 | $head[$h][2] = 'settings'; |
41 | 41 | $h++; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | //); // to remove a tab |
51 | 51 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); |
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; |
|
53 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_extrafields.php'; |
|
54 | 54 | $head[$h][1] = $langs->trans("ExtraFields"); |
55 | 55 | $head[$h][2] = 'attributes'; |
56 | 56 | $h++; |
57 | 57 | |
58 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php'; |
|
58 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_type_extrafields.php'; |
|
59 | 59 | $head[$h][1] = $langs->trans("ExtraFieldsAssetsType"); |
60 | 60 | $head[$h][2] = 'attributes_type'; |
61 | 61 | $h++; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $h = 0; |
80 | 80 | $head = array(); |
81 | 81 | |
82 | - $head[$h][0] = DOL_URL_ROOT . '/asset/card.php'; |
|
82 | + $head[$h][0] = DOL_URL_ROOT.'/asset/card.php'; |
|
83 | 83 | $head[$h][1] = $langs->trans("Card"); |
84 | 84 | $head[$h][2] = 'card'; |
85 | 85 | $h++; |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | |
97 | 97 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
99 | + $upload_dir = $conf->assets->dir_output.'/'.get_exdir($filename, 2, 0, 1, $object, 'assets').'/'.dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
105 | 105 | $head[$h][2] = 'documents'; |
106 | 106 | $h++; |
107 | 107 | |
108 | 108 | $nbNote = 0; |
109 | - if(!empty($object->note_private)) $nbNote++; |
|
110 | - if(!empty($object->note_public)) $nbNote++; |
|
109 | + if (!empty($object->note_private)) $nbNote++; |
|
110 | + if (!empty($object->note_public)) $nbNote++; |
|
111 | 111 | $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
112 | 112 | $head[$h][1] = $langs->trans("Notes"); |
113 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
113 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | 114 | $head[$h][2] = 'note'; |
115 | 115 | $h++; |
116 | 116 | |
117 | - $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id; |
|
117 | + $head[$h][0] = DOL_URL_ROOT.'/asset/info.php?id='.$object->id; |
|
118 | 118 | $head[$h][1] = $langs->trans("Info"); |
119 | 119 | $head[$h][2] = 'info'; |
120 | 120 | $h++; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | global $langs, $conf, $user; |
136 | 136 | |
137 | - $h=0; |
|
137 | + $h = 0; |
|
138 | 138 | $head = array(); |
139 | 139 | |
140 | 140 | $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | // Entries must be declared in modules descriptor with line |
147 | 147 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
148 | 148 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
149 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype'); |
|
149 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype'); |
|
150 | 150 | |
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove'); |
|
151 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype', 'remove'); |
|
152 | 152 | |
153 | 153 | return $head; |
154 | 154 | } |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | // Entries must be declared in modules descriptor with line |
46 | 46 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
47 | 47 | // $this->tabs = array('entity:-tabname); to remove a tab |
48 | - complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat'); |
|
48 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat'); |
|
49 | 49 | |
50 | 50 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
51 | 51 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
52 | - $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
53 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
54 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
52 | + $upload_dir = $conf->tax->dir_output."/".dol_sanitizeFileName($object->ref); |
|
53 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
54 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
55 | 55 | $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
56 | 56 | $head[$tab][1] = $langs->trans("Documents"); |
57 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
57 | + if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
58 | 58 | $head[$tab][2] = 'documents'; |
59 | 59 | $tab++; |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $head[$tab][2] = 'info'; |
64 | 64 | $tab++; |
65 | 65 | |
66 | - complete_head_from_modules($conf,$langs,$object,$head,$tab,'vat','remove'); |
|
66 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat', 'remove'); |
|
67 | 67 | |
68 | 68 | return $head; |
69 | 69 | } |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $h = 0; |
34 | 34 | $head = array(); |
35 | 35 | |
36 | - $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php'; |
|
36 | + $head[$h][0] = DOL_URL_ROOT.'/don/admin/donation.php'; |
|
37 | 37 | $head[$h][1] = $langs->trans("Miscellaneous"); |
38 | 38 | $head[$h][2] = 'general'; |
39 | - $h ++; |
|
39 | + $h++; |
|
40 | 40 | |
41 | 41 | // Show more tabs from modules |
42 | 42 | // Entries must be declared in modules descriptor with line |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // $this->tabs = array('entity:-tabname); to remove a tab |
45 | 45 | complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin'); |
46 | 46 | |
47 | - $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php'; |
|
47 | + $head[$h][0] = DOL_URL_ROOT.'/don/admin/donation_extrafields.php'; |
|
48 | 48 | $head[$h][1] = $langs->trans("ExtraFields"); |
49 | 49 | $head[$h][2] = 'attributes'; |
50 | 50 | $h++; |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $h = 0; |
68 | 68 | $head = array(); |
69 | 69 | |
70 | - $head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id; |
|
70 | + $head[$h][0] = DOL_URL_ROOT.'/don/card.php?id='.$object->id; |
|
71 | 71 | $head[$h][1] = $langs->trans("Card"); |
72 | 72 | $head[$h][2] = 'card'; |
73 | - $h ++; |
|
73 | + $h++; |
|
74 | 74 | |
75 | 75 | // Show more tabs from modules |
76 | 76 | // Entries must be declared in modules descriptor with line |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | |
81 | 81 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
82 | 82 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
83 | - $upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); |
|
84 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
85 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
83 | + $upload_dir = $conf->don->dir_output.'/'.get_exdir($filename, 2, 0, 1, $object, 'donation').'/'.dol_sanitizeFileName($object->ref); |
|
84 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
85 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
86 | 86 | $head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id; |
87 | 87 | $head[$h][1] = $langs->trans('Documents'); |
88 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
88 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
89 | 89 | $head[$h][2] = 'documents'; |
90 | 90 | $h++; |
91 | 91 | |
92 | 92 | $nbNote = 0; |
93 | - if(!empty($object->note_private)) $nbNote++; |
|
94 | - if(!empty($object->note_public)) $nbNote++; |
|
93 | + if (!empty($object->note_private)) $nbNote++; |
|
94 | + if (!empty($object->note_public)) $nbNote++; |
|
95 | 95 | $head[$h][0] = DOL_URL_ROOT.'/don/note.php?id='.$object->id; |
96 | 96 | $head[$h][1] = $langs->trans("Notes"); |
97 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
97 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
98 | 98 | $head[$h][2] = 'note'; |
99 | 99 | $h++; |
100 | 100 | |
101 | - $head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id; |
|
101 | + $head[$h][0] = DOL_URL_ROOT.'/don/info.php?id='.$object->id; |
|
102 | 102 | $head[$h][1] = $langs->trans("Info"); |
103 | 103 | $head[$h][2] = 'info'; |
104 | 104 | $h++; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $h = 0; |
35 | 35 | $head = array(); |
36 | 36 | |
37 | - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/card.php?id=' . $object->id; |
|
37 | + $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$object->id; |
|
38 | 38 | $head[$h][1] = $langs->trans("Card"); |
39 | 39 | $head[$h][2] = 'card'; |
40 | 40 | $h++; |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | // Entries must be declared in modules descriptor with line |
44 | 44 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
45 | 45 | // $this->tabs = array('entity:-tabname); to remove a tab |
46 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'trip'); |
|
46 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'trip'); |
|
47 | 47 | |
48 | 48 | $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/document.php?id='.$object->id; |
49 | 49 | $head[$h][1] = $langs->trans("Documents"); |
50 | 50 | $head[$h][2] = 'documents'; |
51 | 51 | $h++; |
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id; |
|
53 | + $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/info.php?id='.$object->id; |
|
54 | 54 | $head[$h][1] = $langs->trans("Info"); |
55 | 55 | $head[$h][2] = 'info'; |
56 | 56 | $h++; |
57 | 57 | |
58 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove'); |
|
58 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'trip', 'remove'); |
|
59 | 59 | |
60 | 60 | return $head; |
61 | 61 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string $type Type of category |
30 | 30 | * @return array Array of tabs to show |
31 | 31 | */ |
32 | -function categories_prepare_head($object,$type) |
|
32 | +function categories_prepare_head($object, $type) |
|
33 | 33 | { |
34 | 34 | global $langs, $conf, $user; |
35 | 35 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $head[$h][2] = 'photos'; |
50 | 50 | $h++; |
51 | 51 | |
52 | - if (! empty($conf->global->MAIN_MULTILANGS)) |
|
52 | + if (!empty($conf->global->MAIN_MULTILANGS)) |
|
53 | 53 | { |
54 | 54 | $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&type='.$type; |
55 | 55 | $head[$h][1] = $langs->trans("Translation"); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | // Entries must be declared in modules descriptor with line |
62 | 62 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
63 | 63 | // $this->tabs = array('entity:-tabname); to remove a tab |
64 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type); |
|
64 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type); |
|
65 | 65 | |
66 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove'); |
|
66 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type, 'remove'); |
|
67 | 67 | |
68 | 68 | return $head; |
69 | 69 | } |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | // Entries must be declared in modules descriptor with line |
98 | 98 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
99 | 99 | // $this->tabs = array('entity:-tabname); to remove a tab |
100 | - complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin'); |
|
100 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin'); |
|
101 | 101 | |
102 | - complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove'); |
|
102 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin', 'remove'); |
|
103 | 103 | |
104 | 104 | return $head; |
105 | 105 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $head[$h][2] = 'project'; |
46 | 46 | $h++; |
47 | 47 | |
48 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
48 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
49 | 49 | $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id; |
50 | 50 | $head[$h][1] = $langs->trans("ProjectContact"); |
51 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
51 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
52 | 52 | $head[$h][2] = 'contact'; |
53 | 53 | $h++; |
54 | 54 | |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | $head[$h][1] = $langs->trans("Tasks"); |
60 | 60 | |
61 | 61 | require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
62 | - $taskstatic=new Task($db); |
|
63 | - $nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); |
|
64 | - if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>'; |
|
62 | + $taskstatic = new Task($db); |
|
63 | + $nbTasks = count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); |
|
64 | + if ($nbTasks > 0) $head[$h][1] .= ' <span class="badge">'.($nbTasks).'</span>'; |
|
65 | 65 | $head[$h][2] = 'tasks'; |
66 | 66 | $h++; |
67 | 67 | |
68 | - $nbTimeSpent=0; |
|
68 | + $nbTimeSpent = 0; |
|
69 | 69 | $sql = "SELECT t.rowid"; |
70 | 70 | //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
71 | 71 | //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
@@ -76,20 +76,20 @@ discard block |
||
76 | 76 | if ($resql) |
77 | 77 | { |
78 | 78 | $obj = $db->fetch_object($resql); |
79 | - if ($obj) $nbTimeSpent=1; |
|
79 | + if ($obj) $nbTimeSpent = 1; |
|
80 | 80 | } |
81 | 81 | else dol_print_error($db); |
82 | 82 | |
83 | 83 | $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; |
84 | 84 | $head[$h][1] = $langs->trans("TimeSpent"); |
85 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
85 | + if ($nbTimeSpent > 0) $head[$h][1] .= ' <span class="badge">...</span>'; |
|
86 | 86 | $head[$h][2] = 'timespent'; |
87 | 87 | $h++; |
88 | 88 | } |
89 | 89 | |
90 | - if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) |
|
91 | - || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) |
|
92 | - || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) |
|
90 | + if (!empty($conf->fournisseur->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) |
|
91 | + || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled) |
|
92 | + || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) |
|
93 | 93 | { |
94 | 94 | $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; |
95 | 95 | $head[$h][1] = $langs->trans("ProjectOverview"); |
@@ -101,29 +101,29 @@ discard block |
||
101 | 101 | // Entries must be declared in modules descriptor with line |
102 | 102 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
103 | 103 | // $this->tabs = array('entity:-tabname); to remove a tab |
104 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'project'); |
|
104 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'project'); |
|
105 | 105 | |
106 | 106 | |
107 | 107 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
108 | 108 | { |
109 | 109 | $nbNote = 0; |
110 | - if(!empty($object->note_private)) $nbNote++; |
|
111 | - if(!empty($object->note_public)) $nbNote++; |
|
110 | + if (!empty($object->note_private)) $nbNote++; |
|
111 | + if (!empty($object->note_public)) $nbNote++; |
|
112 | 112 | $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id; |
113 | 113 | $head[$h][1] = $langs->trans('Notes'); |
114 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
115 | 115 | $head[$h][2] = 'notes'; |
116 | 116 | $h++; |
117 | 117 | } |
118 | 118 | |
119 | 119 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
120 | 120 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
121 | - $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
122 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
123 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
121 | + $upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($object->ref); |
|
122 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
123 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
124 | 124 | $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; |
125 | 125 | $head[$h][1] = $langs->trans('Documents'); |
126 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
126 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
127 | 127 | $head[$h][2] = 'document'; |
128 | 128 | $h++; |
129 | 129 | |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | $nbComments = $object->getNbComments(); |
134 | 134 | $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; |
135 | 135 | $head[$h][1] = $langs->trans("CommentLink"); |
136 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
136 | + if ($nbComments > 0) $head[$h][1] .= ' <span class="badge">'.$nbComments.'</span>'; |
|
137 | 137 | $head[$h][2] = 'project_comment'; |
138 | 138 | $h++; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; |
142 | - $head[$h][1].= $langs->trans("Events"); |
|
143 | - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
142 | + $head[$h][1] .= $langs->trans("Events"); |
|
143 | + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) |
|
144 | 144 | { |
145 | - $head[$h][1].= '/'; |
|
146 | - $head[$h][1].= $langs->trans("Agenda"); |
|
145 | + $head[$h][1] .= '/'; |
|
146 | + $head[$h][1] .= $langs->trans("Agenda"); |
|
147 | 147 | } |
148 | 148 | $head[$h][2] = 'agenda'; |
149 | 149 | $h++; |
150 | 150 | |
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove'); |
|
151 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'project', 'remove'); |
|
152 | 152 | |
153 | 153 | return $head; |
154 | 154 | } |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | $h = 0; |
167 | 167 | $head = array(); |
168 | 168 | |
169 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
169 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
170 | 170 | $head[$h][1] = $langs->trans("Card"); |
171 | 171 | $head[$h][2] = 'task_task'; |
172 | 172 | $h++; |
173 | 173 | |
174 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
175 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
174 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
175 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
176 | 176 | $head[$h][1] = $langs->trans("TaskRessourceLinks"); |
177 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
177 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
178 | 178 | $head[$h][2] = 'task_contact'; |
179 | 179 | $h++; |
180 | 180 | |
181 | 181 | // Is there timespent ? |
182 | - $nbTimeSpent=0; |
|
182 | + $nbTimeSpent = 0; |
|
183 | 183 | $sql = "SELECT t.rowid"; |
184 | 184 | //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
185 | 185 | //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | if ($resql) |
190 | 190 | { |
191 | 191 | $obj = $db->fetch_object($resql); |
192 | - if ($obj) $nbTimeSpent=1; |
|
192 | + if ($obj) $nbTimeSpent = 1; |
|
193 | 193 | } |
194 | 194 | else dol_print_error($db); |
195 | 195 | |
196 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
196 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
197 | 197 | $head[$h][1] = $langs->trans("TimeSpent"); |
198 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
198 | + if ($nbTimeSpent > 0) $head[$h][1] .= ' <span class="badge">...</span>'; |
|
199 | 199 | $head[$h][2] = 'task_time'; |
200 | 200 | $h++; |
201 | 201 | |
@@ -203,28 +203,28 @@ discard block |
||
203 | 203 | // Entries must be declared in modules descriptor with line |
204 | 204 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
205 | 205 | // $this->tabs = array('entity:-tabname); to remove a tab |
206 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); |
|
206 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'task'); |
|
207 | 207 | |
208 | 208 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
209 | 209 | { |
210 | 210 | $nbNote = 0; |
211 | - if(!empty($object->note_private)) $nbNote++; |
|
212 | - if(!empty($object->note_public)) $nbNote++; |
|
213 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
211 | + if (!empty($object->note_private)) $nbNote++; |
|
212 | + if (!empty($object->note_public)) $nbNote++; |
|
213 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
214 | 214 | $head[$h][1] = $langs->trans('Notes'); |
215 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
215 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
216 | 216 | $head[$h][2] = 'task_notes'; |
217 | 217 | $h++; |
218 | 218 | } |
219 | 219 | |
220 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
221 | - $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); |
|
220 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
221 | + $filesdir = $conf->projet->dir_output."/".dol_sanitizeFileName($object->project->ref).'/'.dol_sanitizeFileName($object->ref); |
|
222 | 222 | include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
223 | 223 | include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
224 | - $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
225 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
224 | + $nbFiles = count(dol_dir_list($filesdir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
225 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
226 | 226 | $head[$h][1] = $langs->trans('Documents'); |
227 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
227 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
228 | 228 | $head[$h][2] = 'task_document'; |
229 | 229 | $h++; |
230 | 230 | |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) |
233 | 233 | { |
234 | 234 | $nbComments = $object->getNbComments(); |
235 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
235 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
236 | 236 | $head[$h][1] = $langs->trans("CommentLink"); |
237 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
237 | + if ($nbComments > 0) $head[$h][1] .= ' <span class="badge">'.$nbComments.'</span>'; |
|
238 | 238 | $head[$h][2] = 'task_comment'; |
239 | 239 | $h++; |
240 | 240 | } |
241 | 241 | |
242 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove'); |
|
242 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'task', 'remove'); |
|
243 | 243 | |
244 | 244 | return $head; |
245 | 245 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param string $fuser Filter on user |
252 | 252 | * @return array Array of tabs to show |
253 | 253 | */ |
254 | -function project_timesheet_prepare_head($mode, $fuser=null) |
|
254 | +function project_timesheet_prepare_head($mode, $fuser = null) |
|
255 | 255 | { |
256 | 256 | global $langs, $conf, $user; |
257 | 257 | $h = 0; |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | $h = 0; |
261 | 261 | |
262 | - $param=''; |
|
263 | - $param.=($mode?'&mode='.$mode:''); |
|
264 | - if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id; |
|
262 | + $param = ''; |
|
263 | + $param .= ($mode ? '&mode='.$mode : ''); |
|
264 | + if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param .= '&search_usertoprocessid='.$fuser->id; |
|
265 | 265 | |
266 | 266 | if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) |
267 | 267 | { |
268 | - $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param?'?'.$param:''); |
|
268 | + $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param ? '?'.$param : ''); |
|
269 | 269 | $head[$h][1] = $langs->trans("InputPerWeek"); |
270 | 270 | $head[$h][2] = 'inputperweek'; |
271 | 271 | $h++; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) |
275 | 275 | { |
276 | - $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param?'?'.$param:''); |
|
276 | + $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param ? '?'.$param : ''); |
|
277 | 277 | $head[$h][1] = $langs->trans("InputPerDay"); |
278 | 278 | $head[$h][2] = 'inputperday'; |
279 | 279 | $h++; |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $h++; |
288 | 288 | }*/ |
289 | 289 | |
290 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet'); |
|
290 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet'); |
|
291 | 291 | |
292 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet','remove'); |
|
292 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet', 'remove'); |
|
293 | 293 | |
294 | 294 | return $head; |
295 | 295 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $head[$h][2] = 'project'; |
314 | 314 | $h++; |
315 | 315 | |
316 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin'); |
|
316 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_admin'); |
|
317 | 317 | |
318 | 318 | $head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php"; |
319 | 319 | $head[$h][1] = $langs->trans("ExtraFieldsProject"); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $head[$h][2] = 'attributes_task'; |
326 | 326 | $h++; |
327 | 327 | |
328 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin','remove'); |
|
328 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_admin', 'remove'); |
|
329 | 329 | |
330 | 330 | return $head; |
331 | 331 | } |
@@ -347,15 +347,15 @@ discard block |
||
347 | 347 | * @param string $filterprogresscalc filter text |
348 | 348 | * @return void |
349 | 349 | */ |
350 | -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0, $filterprogresscalc='') |
|
350 | +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '') |
|
351 | 351 | { |
352 | 352 | global $user, $bc, $langs, $conf, $db; |
353 | 353 | global $projectstatic, $taskstatic; |
354 | 354 | |
355 | - $lastprojectid=0; |
|
355 | + $lastprojectid = 0; |
|
356 | 356 | |
357 | - $projectsArrayId=explode(',',$projectsListId); |
|
358 | - if ($filterprogresscalc!=='') { |
|
357 | + $projectsArrayId = explode(',', $projectsListId); |
|
358 | + if ($filterprogresscalc !== '') { |
|
359 | 359 | foreach ($lines as $key=>$line) { |
360 | 360 | if (!empty($line->planned_workload) && !empty($line->duration)) { |
361 | 361 | $filterprogresscalc = str_replace(' = ', ' == ', $filterprogresscalc); |
@@ -364,23 +364,23 @@ discard block |
||
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
367 | - $lines=array_values($lines); |
|
367 | + $lines = array_values($lines); |
|
368 | 368 | } |
369 | 369 | |
370 | - $numlines=count($lines); |
|
370 | + $numlines = count($lines); |
|
371 | 371 | |
372 | 372 | // We declare counter as global because we want to edit them into recursive call |
373 | - global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned; |
|
373 | + global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned; |
|
374 | 374 | if ($level == 0) |
375 | 375 | { |
376 | - $total_projectlinesa_spent=0; |
|
377 | - $total_projectlinesa_planned=0; |
|
378 | - $total_projectlinesa_spent_if_planned=0; |
|
376 | + $total_projectlinesa_spent = 0; |
|
377 | + $total_projectlinesa_planned = 0; |
|
378 | + $total_projectlinesa_spent_if_planned = 0; |
|
379 | 379 | } |
380 | 380 | |
381 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
381 | + for ($i = 0; $i < $numlines; $i++) |
|
382 | 382 | { |
383 | - if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
383 | + if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
384 | 384 | |
385 | 385 | // Process line |
386 | 386 | // print "i:".$i."-".$lines[$i]->fk_project.'<br>'; |
@@ -388,26 +388,26 @@ discard block |
||
388 | 388 | if ($lines[$i]->fk_parent == $parent || $level < 0) // if $level = -1, we dont' use sublevel recursion, we show all lines |
389 | 389 | { |
390 | 390 | // Show task line. |
391 | - $showline=1; |
|
392 | - $showlineingray=0; |
|
391 | + $showline = 1; |
|
392 | + $showlineingray = 0; |
|
393 | 393 | |
394 | 394 | // If there is filters to use |
395 | 395 | if (is_array($taskrole)) |
396 | 396 | { |
397 | 397 | // If task not legitimate to show, search if a legitimate task exists later in tree |
398 | - if (! isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) |
|
398 | + if (!isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) |
|
399 | 399 | { |
400 | 400 | // So search if task has a subtask legitimate to show |
401 | - $foundtaskforuserdeeper=0; |
|
402 | - searchTaskInChild($foundtaskforuserdeeper,$lines[$i]->id,$lines,$taskrole); |
|
401 | + $foundtaskforuserdeeper = 0; |
|
402 | + searchTaskInChild($foundtaskforuserdeeper, $lines[$i]->id, $lines, $taskrole); |
|
403 | 403 | //print '$foundtaskforuserpeeper='.$foundtaskforuserdeeper.'<br>'; |
404 | 404 | if ($foundtaskforuserdeeper > 0) |
405 | 405 | { |
406 | - $showlineingray=1; // We will show line but in gray |
|
406 | + $showlineingray = 1; // We will show line but in gray |
|
407 | 407 | } |
408 | 408 | else |
409 | 409 | { |
410 | - $showline=0; // No reason to show line |
|
410 | + $showline = 0; // No reason to show line |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | } |
@@ -418,12 +418,12 @@ discard block |
||
418 | 418 | if (empty($user->rights->projet->all->lire)) |
419 | 419 | { |
420 | 420 | // User is not allowed on this project and project is not public, so we hide line |
421 | - if (! in_array($lines[$i]->fk_project, $projectsArrayId)) |
|
421 | + if (!in_array($lines[$i]->fk_project, $projectsArrayId)) |
|
422 | 422 | { |
423 | 423 | // Note that having a user assigned to a task into a project user has no permission on, should not be possible |
424 | 424 | // because assignement on task can be done only on contact of project. |
425 | 425 | // If assignement was done and after, was removed from contact of project, then we can hide the line. |
426 | - $showline=0; |
|
426 | + $showline = 0; |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
435 | 435 | { |
436 | 436 | $var = !$var; |
437 | - $lastprojectid=$lines[$i]->fk_project; |
|
437 | + $lastprojectid = $lines[$i]->fk_project; |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | print '<tr '.$bc[$var].' id="row-'.$lines[$i]->id.'">'."\n"; |
@@ -444,18 +444,18 @@ discard block |
||
444 | 444 | // Project ref |
445 | 445 | print "<td>"; |
446 | 446 | //if ($showlineingray) print '<i>'; |
447 | - $projectstatic->id=$lines[$i]->fk_project; |
|
448 | - $projectstatic->ref=$lines[$i]->projectref; |
|
449 | - $projectstatic->public=$lines[$i]->public; |
|
450 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
451 | - if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); |
|
452 | - else print $projectstatic->getNomUrl(1,'nolink'); |
|
447 | + $projectstatic->id = $lines[$i]->fk_project; |
|
448 | + $projectstatic->ref = $lines[$i]->projectref; |
|
449 | + $projectstatic->public = $lines[$i]->public; |
|
450 | + $projectstatic->title = $lines[$i]->projectlabel; |
|
451 | + if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId) || !empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); |
|
452 | + else print $projectstatic->getNomUrl(1, 'nolink'); |
|
453 | 453 | //if ($showlineingray) print '</i>'; |
454 | 454 | print "</td>"; |
455 | 455 | |
456 | 456 | // Project status |
457 | 457 | print '<td>'; |
458 | - $projectstatic->statut=$lines[$i]->projectstatus; |
|
458 | + $projectstatic->statut = $lines[$i]->projectstatus; |
|
459 | 459 | print $projectstatic->getLibStatut(2); |
460 | 460 | print "</td>"; |
461 | 461 | } |
@@ -464,14 +464,14 @@ discard block |
||
464 | 464 | print '<td>'; |
465 | 465 | if ($showlineingray) |
466 | 466 | { |
467 | - print '<i>'.img_object('','projecttask').' '.$lines[$i]->ref.'</i>'; |
|
467 | + print '<i>'.img_object('', 'projecttask').' '.$lines[$i]->ref.'</i>'; |
|
468 | 468 | } |
469 | 469 | else |
470 | 470 | { |
471 | - $taskstatic->id=$lines[$i]->id; |
|
472 | - $taskstatic->ref=$lines[$i]->ref; |
|
473 | - $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); |
|
474 | - print $taskstatic->getNomUrl(1,'withproject'); |
|
471 | + $taskstatic->id = $lines[$i]->id; |
|
472 | + $taskstatic->ref = $lines[$i]->ref; |
|
473 | + $taskstatic->label = ($taskrole[$lines[$i]->id] ? $langs->trans("YourRole").': '.$taskrole[$lines[$i]->id] : ''); |
|
474 | + print $taskstatic->getNomUrl(1, 'withproject'); |
|
475 | 475 | } |
476 | 476 | print '</td>'; |
477 | 477 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | print "<td>"; |
480 | 480 | if ($showlineingray) print '<i>'; |
481 | 481 | //else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">'; |
482 | - for ($k = 0 ; $k < $level ; $k++) |
|
482 | + for ($k = 0; $k < $level; $k++) |
|
483 | 483 | { |
484 | 484 | print " "; |
485 | 485 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | // Date start |
492 | 492 | print '<td align="center">'; |
493 | - print dol_print_date($lines[$i]->date_start,'dayhour'); |
|
493 | + print dol_print_date($lines[$i]->date_start, 'dayhour'); |
|
494 | 494 | print '</td>'; |
495 | 495 | |
496 | 496 | // Date end |
@@ -499,19 +499,19 @@ discard block |
||
499 | 499 | $taskstatic->progress = $lines[$i]->progress; |
500 | 500 | $taskstatic->fk_statut = $lines[$i]->status; |
501 | 501 | $taskstatic->datee = $lines[$i]->date_end; |
502 | - print dol_print_date($lines[$i]->date_end,'dayhour'); |
|
502 | + print dol_print_date($lines[$i]->date_end, 'dayhour'); |
|
503 | 503 | if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); |
504 | 504 | print '</td>'; |
505 | 505 | |
506 | - $plannedworkloadoutputformat='allhourmin'; |
|
507 | - $timespentoutputformat='allhourmin'; |
|
508 | - if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
509 | - if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
506 | + $plannedworkloadoutputformat = 'allhourmin'; |
|
507 | + $timespentoutputformat = 'allhourmin'; |
|
508 | + if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
509 | + if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
510 | 510 | |
511 | 511 | // Planned Workload (in working hours) |
512 | 512 | print '<td align="right">'; |
513 | - $fullhour=convertSecondToTime($lines[$i]->planned_workload,$plannedworkloadoutputformat); |
|
514 | - $workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
513 | + $fullhour = convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat); |
|
514 | + $workingdelay = convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
515 | 515 | if ($lines[$i]->planned_workload != '') |
516 | 516 | { |
517 | 517 | print $fullhour; |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | // Time spent |
525 | 525 | print '<td align="right">'; |
526 | 526 | if ($showlineingray) print '<i>'; |
527 | - else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">'; |
|
528 | - if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,$timespentoutputformat); |
|
527 | + else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ? '' : '&withproject=1').'">'; |
|
528 | + if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration, $timespentoutputformat); |
|
529 | 529 | else print '--:--'; |
530 | 530 | if ($showlineingray) print '</i>'; |
531 | 531 | else print '</a>'; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | print '<td align="right">'; |
536 | 536 | if ($lines[$i]->planned_workload || $lines[$i]->duration) |
537 | 537 | { |
538 | - if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; |
|
538 | + if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2).' %'; |
|
539 | 539 | else print '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>'; |
540 | 540 | } |
541 | 541 | print '</td>'; |
@@ -549,20 +549,20 @@ discard block |
||
549 | 549 | print '</td>'; |
550 | 550 | |
551 | 551 | // Contacts of task |
552 | - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
552 | + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
553 | 553 | { |
554 | 554 | print '<td>'; |
555 | - foreach(array('internal','external') as $source) |
|
555 | + foreach (array('internal', 'external') as $source) |
|
556 | 556 | { |
557 | - $tab = $lines[$i]->liste_contact(-1,$source); |
|
558 | - $num=count($tab); |
|
559 | - if (!empty($num)){ |
|
560 | - foreach ($tab as $contacttask){ |
|
557 | + $tab = $lines[$i]->liste_contact(-1, $source); |
|
558 | + $num = count($tab); |
|
559 | + if (!empty($num)) { |
|
560 | + foreach ($tab as $contacttask) { |
|
561 | 561 | //var_dump($contacttask); |
562 | 562 | if ($source == 'internal') $c = new User($db); |
563 | 563 | else $c = new Contact($db); |
564 | 564 | $c->fetch($contacttask['id']); |
565 | - print $c->getNomUrl(1) . ' (' . $contacttask['libelle'] . ')' . '<br>'; |
|
565 | + print $c->getNomUrl(1).' ('.$contacttask['libelle'].')'.'<br>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | print "</tr>\n"; |
579 | 579 | |
580 | - if (! $showlineingray) $inc++; |
|
580 | + if (!$showlineingray) $inc++; |
|
581 | 581 | |
582 | 582 | if ($level >= 0) // Call sublevels |
583 | 583 | { |
@@ -609,16 +609,16 @@ discard block |
||
609 | 609 | print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); |
610 | 610 | print '</td>'; |
611 | 611 | print '<td align="right" class="nowrap liste_total">'; |
612 | - if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject?'':'&withproject=1').'">'; |
|
612 | + if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ? '' : '&withproject=1').'">'; |
|
613 | 613 | print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); |
614 | 614 | if ($projectidfortotallink > 0) print '</a>'; |
615 | 615 | print '</td>'; |
616 | 616 | print '<td align="right" class="nowrap liste_total">'; |
617 | - if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %'; |
|
617 | + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %'; |
|
618 | 618 | print '</td>'; |
619 | 619 | print '<td></td>'; |
620 | 620 | // Contacts of task |
621 | - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
621 | + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
622 | 622 | { |
623 | 623 | print '<td></td>'; |
624 | 624 | } |
@@ -647,48 +647,48 @@ discard block |
||
647 | 647 | * @param int $oldprojectforbreak Old project id of last project break |
648 | 648 | * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks |
649 | 649 | */ |
650 | -function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0) |
|
650 | +function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0) |
|
651 | 651 | { |
652 | 652 | global $conf, $db, $user, $bc, $langs; |
653 | 653 | global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
654 | 654 | |
655 | - $lastprojectid=0; |
|
656 | - $totalforeachline=array(); |
|
657 | - $workloadforid=array(); |
|
658 | - $lineswithoutlevel0=array(); |
|
655 | + $lastprojectid = 0; |
|
656 | + $totalforeachline = array(); |
|
657 | + $workloadforid = array(); |
|
658 | + $lineswithoutlevel0 = array(); |
|
659 | 659 | |
660 | - $numlines=count($lines); |
|
660 | + $numlines = count($lines); |
|
661 | 661 | |
662 | 662 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
663 | 663 | if ($parent == 0) // Always and only if at first level |
664 | 664 | { |
665 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
665 | + for ($i = 0; $i < $numlines; $i++) |
|
666 | 666 | { |
667 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
667 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; |
|
668 | 668 | } |
669 | 669 | } |
670 | 670 | |
671 | 671 | if (empty($oldprojectforbreak)) |
672 | 672 | { |
673 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
673 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
677 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
677 | + for ($i = 0; $i < $numlines; $i++) |
|
678 | 678 | { |
679 | 679 | if ($parent == 0) $level = 0; |
680 | 680 | |
681 | 681 | //if ($lines[$i]->fk_task_parent == $parent) |
682 | 682 | //{ |
683 | 683 | // If we want all or we have a role on task, we show it |
684 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
684 | + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) |
|
685 | 685 | { |
686 | 686 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
687 | 687 | |
688 | 688 | // Break on a new project |
689 | 689 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
690 | 690 | { |
691 | - $lastprojectid=$lines[$i]->fk_project; |
|
691 | + $lastprojectid = $lines[$i]->fk_project; |
|
692 | 692 | if ($preselectedday) |
693 | 693 | { |
694 | 694 | $projectstatic->id = $lines[$i]->fk_project; |
@@ -699,31 +699,31 @@ discard block |
||
699 | 699 | { |
700 | 700 | if ($preselectedday) |
701 | 701 | { |
702 | - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
703 | - $workloadforid[$projectstatic->id]=1; |
|
702 | + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
703 | + $workloadforid[$projectstatic->id] = 1; |
|
704 | 704 | } |
705 | 705 | } |
706 | 706 | |
707 | - $projectstatic->id=$lines[$i]->fk_project; |
|
708 | - $projectstatic->ref=$lines[$i]->project_ref; |
|
709 | - $projectstatic->title=$lines[$i]->project_label; |
|
710 | - $projectstatic->public=$lines[$i]->public; |
|
707 | + $projectstatic->id = $lines[$i]->fk_project; |
|
708 | + $projectstatic->ref = $lines[$i]->project_ref; |
|
709 | + $projectstatic->title = $lines[$i]->project_label; |
|
710 | + $projectstatic->public = $lines[$i]->public; |
|
711 | 711 | |
712 | - $taskstatic->id=$lines[$i]->task_id; |
|
713 | - $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); |
|
714 | - $taskstatic->label=$lines[$i]->task_label; |
|
715 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
716 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
712 | + $taskstatic->id = $lines[$i]->task_id; |
|
713 | + $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id); |
|
714 | + $taskstatic->label = $lines[$i]->task_label; |
|
715 | + $taskstatic->date_start = $lines[$i]->date_start; |
|
716 | + $taskstatic->date_end = $lines[$i]->date_end; |
|
717 | 717 | |
718 | - $thirdpartystatic->id=$lines[$i]->socid; |
|
719 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
720 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
718 | + $thirdpartystatic->id = $lines[$i]->socid; |
|
719 | + $thirdpartystatic->name = $lines[$i]->thirdparty_name; |
|
720 | + $thirdpartystatic->email = $lines[$i]->thirdparty_email; |
|
721 | 721 | |
722 | 722 | if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
723 | 723 | { |
724 | 724 | print '<tr class="oddeven trforbreak">'."\n"; |
725 | 725 | print '<td colspan="11">'; |
726 | - print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
726 | + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
727 | 727 | if ($projectstatic->title) |
728 | 728 | { |
729 | 729 | print ' - '; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | print "<td>"; |
749 | 749 | if ($oldprojectforbreak == -1) |
750 | 750 | { |
751 | - print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
751 | + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
752 | 752 | print '<br>'.$projectstatic->title; |
753 | 753 | } |
754 | 754 | print "</td>"; |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | // Ref |
762 | 762 | print '<td>'; |
763 | 763 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
764 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
764 | + for ($k = 0; $k < $level; $k++) print " "; |
|
765 | 765 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
766 | 766 | // Label task |
767 | 767 | print '<br>'; |
768 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
768 | + for ($k = 0; $k < $level; $k++) print " "; |
|
769 | 769 | print $taskstatic->label; |
770 | 770 | //print "<br>"; |
771 | 771 | //for ($k = 0 ; $k < $level ; $k++) print " "; |
@@ -774,47 +774,47 @@ discard block |
||
774 | 774 | |
775 | 775 | // Date |
776 | 776 | print '<td align="center">'; |
777 | - print dol_print_date($lines[$i]->timespent_datehour,'day'); |
|
777 | + print dol_print_date($lines[$i]->timespent_datehour, 'day'); |
|
778 | 778 | print '</td>'; |
779 | 779 | |
780 | - $disabledproject=1;$disabledtask=1; |
|
780 | + $disabledproject = 1; $disabledtask = 1; |
|
781 | 781 | //print "x".$lines[$i]->fk_project; |
782 | 782 | //var_dump($lines[$i]); |
783 | 783 | //var_dump($projectsrole[$lines[$i]->fk_project]); |
784 | 784 | // If at least one role for project |
785 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
785 | + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
786 | 786 | { |
787 | - $disabledproject=0; |
|
788 | - $disabledtask=0; |
|
787 | + $disabledproject = 0; |
|
788 | + $disabledtask = 0; |
|
789 | 789 | } |
790 | 790 | // If $restricteditformytask is on and I have no role on task, i disable edit |
791 | 791 | if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
792 | 792 | { |
793 | - $disabledtask=1; |
|
793 | + $disabledtask = 1; |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | // Hour |
797 | 797 | print '<td class="nowrap" align="center">'; |
798 | - print dol_print_date($lines[$i]->timespent_datehour,'hour'); |
|
798 | + print dol_print_date($lines[$i]->timespent_datehour, 'hour'); |
|
799 | 799 | print '</td>'; |
800 | 800 | |
801 | - $cssonholiday=''; |
|
802 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
803 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
804 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
801 | + $cssonholiday = ''; |
|
802 | + if (!$isavailable[$preselectedday]['morning'] && !$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayallday '; |
|
803 | + elseif (!$isavailable[$preselectedday]['morning']) $cssonholiday .= 'onholidaymorning '; |
|
804 | + elseif (!$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayafternoon '; |
|
805 | 805 | |
806 | 806 | // Duration |
807 | - print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">'; |
|
807 | + print '<td align="center" class="duration'.($cssonholiday ? ' '.$cssonholiday : '').'">'; |
|
808 | 808 | |
809 | 809 | $dayWorkLoad = $lines[$i]->timespent_duration; |
810 | - $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; |
|
810 | + $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration; |
|
811 | 811 | |
812 | - $alreadyspent=''; |
|
813 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
812 | + $alreadyspent = ''; |
|
813 | + if ($dayWorkLoad > 0) $alreadyspent = convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); |
|
814 | 814 | |
815 | - print convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
815 | + print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); |
|
816 | 816 | |
817 | - $modeinput='hours'; |
|
817 | + $modeinput = 'hours'; |
|
818 | 818 | |
819 | 819 | print '<script type="text/javascript">'; |
820 | 820 | print "jQuery(document).ready(function () {\n"; |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | |
827 | 827 | // Note |
828 | 828 | print '<td align="center">'; |
829 | - print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
829 | + print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask ? ' disabled="disabled"' : '').'>'; |
|
830 | 830 | print $lines[$i]->timespent_note; |
831 | 831 | print '</textarea>'; |
832 | 832 | print '</td>'; |
@@ -873,41 +873,41 @@ discard block |
||
873 | 873 | * @param int $oldprojectforbreak Old project id of last project break |
874 | 874 | * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks |
875 | 875 | */ |
876 | -function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0) |
|
876 | +function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0) |
|
877 | 877 | { |
878 | 878 | global $conf, $db, $user, $bc, $langs; |
879 | 879 | global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
880 | 880 | |
881 | - $lastprojectid=0; |
|
882 | - $totalforeachday=array(); |
|
883 | - $workloadforid=array(); |
|
884 | - $lineswithoutlevel0=array(); |
|
881 | + $lastprojectid = 0; |
|
882 | + $totalforeachday = array(); |
|
883 | + $workloadforid = array(); |
|
884 | + $lineswithoutlevel0 = array(); |
|
885 | 885 | |
886 | - $numlines=count($lines); |
|
886 | + $numlines = count($lines); |
|
887 | 887 | |
888 | 888 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
889 | 889 | if ($parent == 0) // Always and only if at first level |
890 | 890 | { |
891 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
891 | + for ($i = 0; $i < $numlines; $i++) |
|
892 | 892 | { |
893 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
893 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; |
|
894 | 894 | } |
895 | 895 | } |
896 | 896 | |
897 | 897 | if (empty($oldprojectforbreak)) |
898 | 898 | { |
899 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
899 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
903 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
903 | + for ($i = 0; $i < $numlines; $i++) |
|
904 | 904 | { |
905 | 905 | if ($parent == 0) $level = 0; |
906 | 906 | |
907 | 907 | if ($lines[$i]->fk_task_parent == $parent) |
908 | 908 | { |
909 | 909 | // If we want all or we have a role on task, we show it |
910 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
910 | + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) |
|
911 | 911 | { |
912 | 912 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
913 | 913 | |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | // Break on a new project |
920 | 920 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
921 | 921 | { |
922 | - $lastprojectid=$lines[$i]->fk_project; |
|
922 | + $lastprojectid = $lines[$i]->fk_project; |
|
923 | 923 | if ($preselectedday) |
924 | 924 | { |
925 | 925 | $projectstatic->id = $lines[$i]->fk_project; |
@@ -930,31 +930,31 @@ discard block |
||
930 | 930 | { |
931 | 931 | if ($preselectedday) |
932 | 932 | { |
933 | - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
934 | - $workloadforid[$projectstatic->id]=1; |
|
933 | + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
934 | + $workloadforid[$projectstatic->id] = 1; |
|
935 | 935 | } |
936 | 936 | } |
937 | 937 | |
938 | - $projectstatic->id=$lines[$i]->fk_project; |
|
939 | - $projectstatic->ref=$lines[$i]->projectref; |
|
940 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
941 | - $projectstatic->public=$lines[$i]->public; |
|
938 | + $projectstatic->id = $lines[$i]->fk_project; |
|
939 | + $projectstatic->ref = $lines[$i]->projectref; |
|
940 | + $projectstatic->title = $lines[$i]->projectlabel; |
|
941 | + $projectstatic->public = $lines[$i]->public; |
|
942 | 942 | |
943 | - $taskstatic->id=$lines[$i]->id; |
|
944 | - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
945 | - $taskstatic->label=$lines[$i]->label; |
|
946 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
947 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
943 | + $taskstatic->id = $lines[$i]->id; |
|
944 | + $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id); |
|
945 | + $taskstatic->label = $lines[$i]->label; |
|
946 | + $taskstatic->date_start = $lines[$i]->date_start; |
|
947 | + $taskstatic->date_end = $lines[$i]->date_end; |
|
948 | 948 | |
949 | - $thirdpartystatic->id=$lines[$i]->socid; |
|
950 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
951 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
949 | + $thirdpartystatic->id = $lines[$i]->socid; |
|
950 | + $thirdpartystatic->name = $lines[$i]->thirdparty_name; |
|
951 | + $thirdpartystatic->email = $lines[$i]->thirdparty_email; |
|
952 | 952 | |
953 | 953 | if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
954 | 954 | { |
955 | 955 | print '<tr class="oddeven trforbreak">'."\n"; |
956 | 956 | print '<td colspan="9">'; |
957 | - print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
957 | + print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
958 | 958 | if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
959 | 959 | if ($projectstatic->title) |
960 | 960 | { |
@@ -989,11 +989,11 @@ discard block |
||
989 | 989 | // Ref |
990 | 990 | print '<td>'; |
991 | 991 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
992 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
992 | + for ($k = 0; $k < $level; $k++) print " "; |
|
993 | 993 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
994 | 994 | // Label task |
995 | 995 | print '<br>'; |
996 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
996 | + for ($k = 0; $k < $level; $k++) print " "; |
|
997 | 997 | print $taskstatic->label; |
998 | 998 | //print "<br>"; |
999 | 999 | //for ($k = 0 ; $k < $level ; $k++) print " "; |
@@ -1002,13 +1002,13 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | // Planned Workload |
1004 | 1004 | print '<td align="right" class="leftborder plannedworkload">'; |
1005 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1005 | + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); |
|
1006 | 1006 | else print '--:--'; |
1007 | 1007 | print '</td>'; |
1008 | 1008 | |
1009 | 1009 | // Progress declared % |
1010 | 1010 | print '<td align="right">'; |
1011 | - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1011 | + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress'); |
|
1012 | 1012 | print '</td>'; |
1013 | 1013 | |
1014 | 1014 | // Time spent by everybody |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | if ($lines[$i]->duration) |
1018 | 1018 | { |
1019 | 1019 | print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
1020 | - print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1020 | + print convertSecondToTime($lines[$i]->duration, 'allhourmin'); |
|
1021 | 1021 | print '</a>'; |
1022 | 1022 | } |
1023 | 1023 | else print '--:--'; |
@@ -1025,25 +1025,25 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | // Time spent by user |
1027 | 1027 | print '<td align="right">'; |
1028 | - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1029 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1028 | + $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1029 | + if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin'); |
|
1030 | 1030 | else print '--:--'; |
1031 | 1031 | print "</td>\n"; |
1032 | 1032 | |
1033 | - $disabledproject=1;$disabledtask=1; |
|
1033 | + $disabledproject = 1; $disabledtask = 1; |
|
1034 | 1034 | //print "x".$lines[$i]->fk_project; |
1035 | 1035 | //var_dump($lines[$i]); |
1036 | 1036 | //var_dump($projectsrole[$lines[$i]->fk_project]); |
1037 | 1037 | // If at least one role for project |
1038 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1038 | + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1039 | 1039 | { |
1040 | - $disabledproject=0; |
|
1041 | - $disabledtask=0; |
|
1040 | + $disabledproject = 0; |
|
1041 | + $disabledtask = 0; |
|
1042 | 1042 | } |
1043 | 1043 | // If $restricteditformytask is on and I have no role on task, i disable edit |
1044 | 1044 | if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
1045 | 1045 | { |
1046 | - $disabledtask=1; |
|
1046 | + $disabledtask = 1; |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | // Form to add new time |
@@ -1052,41 +1052,41 @@ discard block |
||
1052 | 1052 | print $tableCell; |
1053 | 1053 | print '</td>'; |
1054 | 1054 | |
1055 | - $cssonholiday=''; |
|
1056 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1057 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1058 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1055 | + $cssonholiday = ''; |
|
1056 | + if (!$isavailable[$preselectedday]['morning'] && !$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayallday '; |
|
1057 | + elseif (!$isavailable[$preselectedday]['morning']) $cssonholiday .= 'onholidaymorning '; |
|
1058 | + elseif (!$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayafternoon '; |
|
1059 | 1059 | |
1060 | 1060 | global $daytoparse; |
1061 | - $tmparray = dol_getdate($daytoparse,true); // detail of current day |
|
1061 | + $tmparray = dol_getdate($daytoparse, true); // detail of current day |
|
1062 | 1062 | $idw = $tmparray['wday']; |
1063 | 1063 | |
1064 | 1064 | global $numstartworkingday, $numendworkingday; |
1065 | - $cssweekend=''; |
|
1065 | + $cssweekend = ''; |
|
1066 | 1066 | if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
1067 | 1067 | { |
1068 | - $cssweekend='weekend'; |
|
1068 | + $cssweekend = 'weekend'; |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | // Duration |
1072 | - print '<td class="center duration'.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1072 | + print '<td class="center duration'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">'; |
|
1073 | 1073 | $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; |
1074 | - $totalforeachday[$preselectedday]+=$dayWorkLoad; |
|
1074 | + $totalforeachday[$preselectedday] += $dayWorkLoad; |
|
1075 | 1075 | |
1076 | - $alreadyspent=''; |
|
1077 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1076 | + $alreadyspent = ''; |
|
1077 | + if ($dayWorkLoad > 0) $alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin'); |
|
1078 | 1078 | |
1079 | 1079 | $idw = 0; |
1080 | 1080 | |
1081 | - $tableCell=''; |
|
1082 | - $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1083 | - $tableCell.='<span class="hideonsmartphone"> + </span>'; |
|
1081 | + $tableCell = ''; |
|
1082 | + $tableCell .= '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1083 | + $tableCell .= '<span class="hideonsmartphone"> + </span>'; |
|
1084 | 1084 | //$tableCell.=' '; |
1085 | - $tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); |
|
1085 | + $tableCell .= $form->select_duration($lines[$i]->id.'duration', '', $disabledtask, 'text', 0, 1); |
|
1086 | 1086 | //$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">'; |
1087 | 1087 | print $tableCell; |
1088 | 1088 | |
1089 | - $modeinput='hours'; |
|
1089 | + $modeinput = 'hours'; |
|
1090 | 1090 | |
1091 | 1091 | print '<script type="text/javascript">'; |
1092 | 1092 | print "jQuery(document).ready(function () {\n"; |
@@ -1098,19 +1098,19 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | // Note |
1100 | 1100 | print '<td align="center">'; |
1101 | - print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
1101 | + print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask ? ' disabled="disabled"' : '').'>'; |
|
1102 | 1102 | print '</textarea>'; |
1103 | 1103 | print '</td>'; |
1104 | 1104 | |
1105 | 1105 | // Warning |
1106 | 1106 | print '<td align="right">'; |
1107 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1107 | + if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); |
|
1108 | 1108 | else if ($disabledtask) |
1109 | 1109 | { |
1110 | 1110 | $titleassigntask = $langs->trans("AssignTaskToMe"); |
1111 | 1111 | if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
1112 | 1112 | |
1113 | - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1113 | + print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1114 | 1114 | } |
1115 | 1115 | print '</td>'; |
1116 | 1116 | |
@@ -1126,9 +1126,9 @@ discard block |
||
1126 | 1126 | $ret = projectLinesPerDay($inc, $lines[$i]->id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak); |
1127 | 1127 | //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
1128 | 1128 | //var_dump($ret); |
1129 | - foreach($ret as $key => $val) |
|
1129 | + foreach ($ret as $key => $val) |
|
1130 | 1130 | { |
1131 | - $totalforeachday[$key]+=$val; |
|
1131 | + $totalforeachday[$key] += $val; |
|
1132 | 1132 | } |
1133 | 1133 | //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
1134 | 1134 | //var_dump($totalforeachday); |
@@ -1162,24 +1162,24 @@ discard block |
||
1162 | 1162 | * @param int $oldprojectforbreak Old project id of last project break |
1163 | 1163 | * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks |
1164 | 1164 | */ |
1165 | -function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0) |
|
1165 | +function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0) |
|
1166 | 1166 | { |
1167 | 1167 | global $conf, $db, $user, $bc, $langs; |
1168 | 1168 | global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
1169 | 1169 | |
1170 | - $numlines=count($lines); |
|
1170 | + $numlines = count($lines); |
|
1171 | 1171 | |
1172 | - $lastprojectid=0; |
|
1173 | - $workloadforid=array(); |
|
1174 | - $totalforeachday=array(); |
|
1175 | - $lineswithoutlevel0=array(); |
|
1172 | + $lastprojectid = 0; |
|
1173 | + $workloadforid = array(); |
|
1174 | + $totalforeachday = array(); |
|
1175 | + $lineswithoutlevel0 = array(); |
|
1176 | 1176 | |
1177 | 1177 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
1178 | 1178 | if ($parent == 0) // Always and only if at first level |
1179 | 1179 | { |
1180 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1180 | + for ($i = 0; $i < $numlines; $i++) |
|
1181 | 1181 | { |
1182 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
1182 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; |
|
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1187,17 +1187,17 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | if (empty($oldprojectforbreak)) |
1189 | 1189 | { |
1190 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break |
|
1190 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1193 | + for ($i = 0; $i < $numlines; $i++) |
|
1194 | 1194 | { |
1195 | 1195 | if ($parent == 0) $level = 0; |
1196 | 1196 | |
1197 | 1197 | if ($lines[$i]->fk_task_parent == $parent) |
1198 | 1198 | { |
1199 | 1199 | // If we want all or we have a role on task, we show it |
1200 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
1200 | + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) |
|
1201 | 1201 | { |
1202 | 1202 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
1203 | 1203 | |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | // Break on a new project |
1210 | 1210 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
1211 | 1211 | { |
1212 | - $lastprojectid=$lines[$i]->fk_project; |
|
1212 | + $lastprojectid = $lines[$i]->fk_project; |
|
1213 | 1213 | $projectstatic->id = $lines[$i]->fk_project; |
1214 | 1214 | } |
1215 | 1215 | |
@@ -1217,33 +1217,33 @@ discard block |
||
1217 | 1217 | //var_dump($projectstatic->weekWorkLoadPerTask); |
1218 | 1218 | if (empty($workloadforid[$projectstatic->id])) |
1219 | 1219 | { |
1220 | - $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
1221 | - $workloadforid[$projectstatic->id]=1; |
|
1220 | + $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
1221 | + $workloadforid[$projectstatic->id] = 1; |
|
1222 | 1222 | } |
1223 | 1223 | //var_dump($projectstatic->weekWorkLoadPerTask); |
1224 | 1224 | //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); |
1225 | 1225 | |
1226 | - $projectstatic->id=$lines[$i]->fk_project; |
|
1227 | - $projectstatic->ref=$lines[$i]->projectref; |
|
1228 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
1229 | - $projectstatic->public=$lines[$i]->public; |
|
1230 | - $projectstatic->thirdparty_name=$lines[$i]->thirdparty_name; |
|
1226 | + $projectstatic->id = $lines[$i]->fk_project; |
|
1227 | + $projectstatic->ref = $lines[$i]->projectref; |
|
1228 | + $projectstatic->title = $lines[$i]->projectlabel; |
|
1229 | + $projectstatic->public = $lines[$i]->public; |
|
1230 | + $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name; |
|
1231 | 1231 | |
1232 | - $taskstatic->id=$lines[$i]->id; |
|
1233 | - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
1234 | - $taskstatic->label=$lines[$i]->label; |
|
1235 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
1236 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
1232 | + $taskstatic->id = $lines[$i]->id; |
|
1233 | + $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id); |
|
1234 | + $taskstatic->label = $lines[$i]->label; |
|
1235 | + $taskstatic->date_start = $lines[$i]->date_start; |
|
1236 | + $taskstatic->date_end = $lines[$i]->date_end; |
|
1237 | 1237 | |
1238 | - $thirdpartystatic->id=$lines[$i]->thirdparty_id; |
|
1239 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
1240 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
1238 | + $thirdpartystatic->id = $lines[$i]->thirdparty_id; |
|
1239 | + $thirdpartystatic->name = $lines[$i]->thirdparty_name; |
|
1240 | + $thirdpartystatic->email = $lines[$i]->thirdparty_email; |
|
1241 | 1241 | |
1242 | 1242 | if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
1243 | 1243 | { |
1244 | 1244 | print '<tr class="oddeven trforbreak">'."\n"; |
1245 | 1245 | print '<td colspan="13">'; |
1246 | - print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
1246 | + print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
1247 | 1247 | if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
1248 | 1248 | if ($projectstatic->title) |
1249 | 1249 | { |
@@ -1278,11 +1278,11 @@ discard block |
||
1278 | 1278 | // Ref |
1279 | 1279 | print '<td class="nowrap">'; |
1280 | 1280 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
1281 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1281 | + for ($k = 0; $k < $level; $k++) print " "; |
|
1282 | 1282 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
1283 | 1283 | // Label task |
1284 | 1284 | print '<br>'; |
1285 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1285 | + for ($k = 0; $k < $level; $k++) print " "; |
|
1286 | 1286 | //print $taskstatic->getNomUrl(0, 'withproject', 'time'); |
1287 | 1287 | print $taskstatic->label; |
1288 | 1288 | //print "<br>"; |
@@ -1292,13 +1292,13 @@ discard block |
||
1292 | 1292 | |
1293 | 1293 | // Planned Workload |
1294 | 1294 | print '<td align="right" class="leftborder plannedworkload">'; |
1295 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1295 | + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); |
|
1296 | 1296 | else print '--:--'; |
1297 | 1297 | print '</td>'; |
1298 | 1298 | |
1299 | 1299 | // Progress declared % |
1300 | 1300 | print '<td align="right">'; |
1301 | - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1301 | + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress'); |
|
1302 | 1302 | print '</td>'; |
1303 | 1303 | |
1304 | 1304 | // Time spent by everybody |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | if ($lines[$i]->duration) |
1308 | 1308 | { |
1309 | 1309 | print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
1310 | - print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1310 | + print convertSecondToTime($lines[$i]->duration, 'allhourmin'); |
|
1311 | 1311 | print '</a>'; |
1312 | 1312 | } |
1313 | 1313 | else print '--:--'; |
@@ -1315,80 +1315,80 @@ discard block |
||
1315 | 1315 | |
1316 | 1316 | // Time spent by user |
1317 | 1317 | print '<td align="right">'; |
1318 | - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1319 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1318 | + $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1319 | + if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin'); |
|
1320 | 1320 | else print '--:--'; |
1321 | 1321 | print "</td>\n"; |
1322 | 1322 | |
1323 | - $disabledproject=1;$disabledtask=1; |
|
1323 | + $disabledproject = 1; $disabledtask = 1; |
|
1324 | 1324 | //print "x".$lines[$i]->fk_project; |
1325 | 1325 | //var_dump($lines[$i]); |
1326 | 1326 | //var_dump($projectsrole[$lines[$i]->fk_project]); |
1327 | 1327 | // If at least one role for project |
1328 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1328 | + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1329 | 1329 | { |
1330 | - $disabledproject=0; |
|
1331 | - $disabledtask=0; |
|
1330 | + $disabledproject = 0; |
|
1331 | + $disabledtask = 0; |
|
1332 | 1332 | } |
1333 | 1333 | // If $restricteditformytask is on and I have no role on task, i disable edit |
1334 | 1334 | if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
1335 | 1335 | { |
1336 | - $disabledtask=1; |
|
1336 | + $disabledtask = 1; |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | //var_dump($projectstatic->weekWorkLoadPerTask); |
1340 | 1340 | |
1341 | 1341 | // Fields to show current time |
1342 | - $tableCell=''; $modeinput='hours'; |
|
1342 | + $tableCell = ''; $modeinput = 'hours'; |
|
1343 | 1343 | for ($idw = 0; $idw < 7; $idw++) |
1344 | 1344 | { |
1345 | - $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
|
1345 | + $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
|
1346 | 1346 | |
1347 | - $cssonholiday=''; |
|
1348 | - if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1349 | - elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1350 | - elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1347 | + $cssonholiday = ''; |
|
1348 | + if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayallday '; |
|
1349 | + elseif (!$isavailable[$tmpday]['morning']) $cssonholiday .= 'onholidaymorning '; |
|
1350 | + elseif (!$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayafternoon '; |
|
1351 | 1351 | |
1352 | - $tmparray=dol_getdate($tmpday); |
|
1352 | + $tmparray = dol_getdate($tmpday); |
|
1353 | 1353 | $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; |
1354 | - $totalforeachday[$tmpday]+=$dayWorkLoad; |
|
1354 | + $totalforeachday[$tmpday] += $dayWorkLoad; |
|
1355 | 1355 | |
1356 | - $alreadyspent=''; |
|
1357 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1358 | - $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); |
|
1356 | + $alreadyspent = ''; |
|
1357 | + if ($dayWorkLoad > 0) $alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin'); |
|
1358 | + $alttitle = $langs->trans("AddHereTimeSpentForDay", $tmparray['day'], $tmparray['mon']); |
|
1359 | 1359 | |
1360 | 1360 | global $numstartworkingday, $numendworkingday; |
1361 | - $cssweekend=''; |
|
1361 | + $cssweekend = ''; |
|
1362 | 1362 | if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
1363 | 1363 | { |
1364 | - $cssweekend='weekend'; |
|
1364 | + $cssweekend = 'weekend'; |
|
1365 | 1365 | } |
1366 | 1366 | |
1367 | - $tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1368 | - $placeholder=''; |
|
1367 | + $tableCell = '<td align="center" class="hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">'; |
|
1368 | + $placeholder = ''; |
|
1369 | 1369 | if ($alreadyspent) |
1370 | 1370 | { |
1371 | - $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1371 | + $tableCell .= '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1372 | 1372 | //$placeholder=' placeholder="00:00"'; |
1373 | 1373 | //$tableCell.='+'; |
1374 | 1374 | } |
1375 | - $tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; |
|
1376 | - $tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"'; |
|
1377 | - $tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"'; |
|
1378 | - $tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />'; |
|
1379 | - $tableCell.='</td>'; |
|
1375 | + $tableCell .= '<input type="text" alt="'.($disabledtask ? '' : $alttitle).'" title="'.($disabledtask ? '' : $alttitle).'" '.($disabledtask ? 'disabled' : $placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; |
|
1376 | + $tableCell .= ' onkeypress="return regexEvent(this,event,\'timeChar\')"'; |
|
1377 | + $tableCell .= ' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"'; |
|
1378 | + $tableCell .= ' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />'; |
|
1379 | + $tableCell .= '</td>'; |
|
1380 | 1380 | print $tableCell; |
1381 | 1381 | } |
1382 | 1382 | |
1383 | 1383 | // Warning |
1384 | 1384 | print '<td align="right">'; |
1385 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1385 | + if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); |
|
1386 | 1386 | else if ($disabledtask) |
1387 | 1387 | { |
1388 | 1388 | $titleassigntask = $langs->trans("AssignTaskToMe"); |
1389 | 1389 | if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
1390 | 1390 | |
1391 | - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1391 | + print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1392 | 1392 | } |
1393 | 1393 | print '</td>'; |
1394 | 1394 | |
@@ -1405,9 +1405,9 @@ discard block |
||
1405 | 1405 | $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak); |
1406 | 1406 | //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
1407 | 1407 | //var_dump($ret); |
1408 | - foreach($ret as $key => $val) |
|
1408 | + foreach ($ret as $key => $val) |
|
1409 | 1409 | { |
1410 | - $totalforeachday[$key]+=$val; |
|
1410 | + $totalforeachday[$key] += $val; |
|
1411 | 1411 | } |
1412 | 1412 | //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
1413 | 1413 | //var_dump($totalforeachday); |
@@ -1436,8 +1436,8 @@ discard block |
||
1436 | 1436 | function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) |
1437 | 1437 | { |
1438 | 1438 | //print 'Search in line with parent id = '.$parent.'<br>'; |
1439 | - $numlines=count($lines); |
|
1440 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1439 | + $numlines = count($lines); |
|
1440 | + for ($i = 0; $i < $numlines; $i++) |
|
1441 | 1441 | { |
1442 | 1442 | // Process line $lines[$i] |
1443 | 1443 | if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent) |
@@ -1473,52 +1473,52 @@ discard block |
||
1473 | 1473 | * @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', ) |
1474 | 1474 | * @return void |
1475 | 1475 | */ |
1476 | -function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=0, $statut=-1, $listofoppstatus=array(),$hiddenfields=array()) |
|
1476 | +function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $statut = -1, $listofoppstatus = array(), $hiddenfields = array()) |
|
1477 | 1477 | { |
1478 | - global $langs,$conf,$user,$bc; |
|
1478 | + global $langs, $conf, $user, $bc; |
|
1479 | 1479 | |
1480 | 1480 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
1481 | 1481 | |
1482 | - $projectstatic=new Project($db); |
|
1483 | - $thirdpartystatic=new Societe($db); |
|
1482 | + $projectstatic = new Project($db); |
|
1483 | + $thirdpartystatic = new Societe($db); |
|
1484 | 1484 | |
1485 | - $sortfield=''; |
|
1486 | - $sortorder=''; |
|
1487 | - $project_year_filter=0; |
|
1485 | + $sortfield = ''; |
|
1486 | + $sortorder = ''; |
|
1487 | + $project_year_filter = 0; |
|
1488 | 1488 | |
1489 | - $title=$langs->trans("Projects"); |
|
1490 | - if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1489 | + $title = $langs->trans("Projects"); |
|
1490 | + if (strcmp($statut, '') && $statut >= 0) $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1491 | 1491 | |
1492 | - $arrayidtypeofcontact=array(); |
|
1492 | + $arrayidtypeofcontact = array(); |
|
1493 | 1493 | |
1494 | 1494 | print '<div class="div-table-responsive-no-min">'; |
1495 | 1495 | print '<table class="noborder" width="100%">'; |
1496 | 1496 | |
1497 | - $sql= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1497 | + $sql = " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1498 | 1498 | if ($mytasks) |
1499 | 1499 | { |
1500 | - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
1501 | - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
1502 | - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
1500 | + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
1501 | + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
1502 | + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
1503 | 1503 | } |
1504 | 1504 | else |
1505 | 1505 | { |
1506 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1506 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1507 | 1507 | } |
1508 | - $sql.= " WHERE p.entity IN (".getEntity('project').")"; |
|
1509 | - $sql.= " AND p.rowid IN (".$projectsListId.")"; |
|
1510 | - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1508 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
1509 | + $sql .= " AND p.rowid IN (".$projectsListId.")"; |
|
1510 | + if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1511 | 1511 | if ($mytasks) |
1512 | 1512 | { |
1513 | - $sql.= " AND p.rowid = t.fk_projet"; |
|
1514 | - $sql.= " AND ec.element_id = t.rowid"; |
|
1515 | - $sql.= " AND ec.fk_socpeople = ".$user->id; |
|
1516 | - $sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact |
|
1517 | - $sql.= " AND ctc.element = 'project_task'"; |
|
1513 | + $sql .= " AND p.rowid = t.fk_projet"; |
|
1514 | + $sql .= " AND ec.element_id = t.rowid"; |
|
1515 | + $sql .= " AND ec.fk_socpeople = ".$user->id; |
|
1516 | + $sql .= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact |
|
1517 | + $sql .= " AND ctc.element = 'project_task'"; |
|
1518 | 1518 | } |
1519 | 1519 | if ($statut >= 0) |
1520 | 1520 | { |
1521 | - $sql.= " AND p.fk_statut = ".$statut; |
|
1521 | + $sql .= " AND p.fk_statut = ".$statut; |
|
1522 | 1522 | } |
1523 | 1523 | if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) |
1524 | 1524 | { |
@@ -1530,40 +1530,40 @@ discard block |
||
1530 | 1530 | { |
1531 | 1531 | $project_year_filter = date("Y"); |
1532 | 1532 | } |
1533 | - $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")"; |
|
1534 | - $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; |
|
1533 | + $sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")"; |
|
1534 | + $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")"; |
|
1535 | 1535 | } |
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | // Get id of project we must show tasks |
1539 | - $arrayidofprojects=array(); |
|
1539 | + $arrayidofprojects = array(); |
|
1540 | 1540 | $sql1 = "SELECT p.rowid as projectid"; |
1541 | - $sql1.= $sql; |
|
1541 | + $sql1 .= $sql; |
|
1542 | 1542 | $resql = $db->query($sql1); |
1543 | 1543 | if ($resql) |
1544 | 1544 | { |
1545 | - $i=0; |
|
1545 | + $i = 0; |
|
1546 | 1546 | $num = $db->num_rows($resql); |
1547 | 1547 | while ($i < $num) |
1548 | 1548 | { |
1549 | 1549 | $objp = $db->fetch_object($resql); |
1550 | - $arrayidofprojects[$objp->projectid]=$objp->projectid; |
|
1550 | + $arrayidofprojects[$objp->projectid] = $objp->projectid; |
|
1551 | 1551 | $i++; |
1552 | 1552 | } |
1553 | 1553 | } |
1554 | 1554 | else dol_print_error($db); |
1555 | - if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1; |
|
1555 | + if (empty($arrayidofprojects)) $arrayidofprojects[0] = -1; |
|
1556 | 1556 | |
1557 | 1557 | // Get list of project with calculation on tasks |
1558 | 1558 | $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,"; |
1559 | - $sql2.= " p.dateo, p.datee,"; |
|
1560 | - $sql2.= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload"; |
|
1561 | - $sql2.= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1562 | - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; |
|
1563 | - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1564 | - $sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")"; |
|
1565 | - $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; |
|
1566 | - $sql2.= " ORDER BY p.title, p.ref"; |
|
1559 | + $sql2 .= " p.dateo, p.datee,"; |
|
1560 | + $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload"; |
|
1561 | + $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1562 | + $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; |
|
1563 | + $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1564 | + $sql2 .= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")"; |
|
1565 | + $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; |
|
1566 | + $sql2 .= " ORDER BY p.title, p.ref"; |
|
1567 | 1567 | |
1568 | 1568 | $resql = $db->query($sql2); |
1569 | 1569 | if ($resql) |
@@ -1576,24 +1576,24 @@ discard block |
||
1576 | 1576 | $i = 0; |
1577 | 1577 | |
1578 | 1578 | print '<tr class="liste_titre">'; |
1579 | - print_liste_field_titre($title.' <span class="badge">'.$num.'</span>',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1580 | - print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1581 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1579 | + print_liste_field_titre($title.' <span class="badge">'.$num.'</span>', $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); |
|
1580 | + print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); |
|
1581 | + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1582 | 1582 | { |
1583 | - print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder); |
|
1584 | - print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder); |
|
1583 | + print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1584 | + print_liste_field_titre("OpportunityStatus", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1585 | 1585 | } |
1586 | 1586 | if (empty($conf->global->PROJECT_HIDE_TASKS)) |
1587 | 1587 | { |
1588 | - print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder); |
|
1589 | - if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder); |
|
1590 | - if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder); |
|
1588 | + print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1589 | + if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1590 | + if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1591 | 1591 | } |
1592 | - print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder); |
|
1592 | + print_liste_field_titre("Status", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1593 | 1593 | print "</tr>\n"; |
1594 | 1594 | |
1595 | - $total_plannedworkload=0; |
|
1596 | - $total_declaredprogressworkload=0; |
|
1595 | + $total_plannedworkload = 0; |
|
1596 | + $total_declaredprogressworkload = 0; |
|
1597 | 1597 | while ($i < $num) |
1598 | 1598 | { |
1599 | 1599 | $objp = $db->fetch_object($resql); |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | $userAccess = $projectstatic->restrictedProjectArea($user); |
1607 | 1607 | if ($userAccess >= 0) |
1608 | 1608 | { |
1609 | - $projectstatic->ref=$objp->ref; |
|
1609 | + $projectstatic->ref = $objp->ref; |
|
1610 | 1610 | $projectstatic->statut = $objp->status; |
1611 | 1611 | $projectstatic->title = $objp->title; |
1612 | 1612 | $projectstatic->datee = $db->jdate($objp->datee); |
@@ -1616,18 +1616,18 @@ discard block |
||
1616 | 1616 | print '<tr class="oddeven">'; |
1617 | 1617 | print '<td>'; |
1618 | 1618 | print $projectstatic->getNomUrl(1); |
1619 | - if (! in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title,24); |
|
1619 | + if (!in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title, 24); |
|
1620 | 1620 | print '</td>'; |
1621 | 1621 | print '<td>'; |
1622 | 1622 | if ($objp->fk_soc > 0) |
1623 | 1623 | { |
1624 | - $thirdpartystatic->id=$objp->fk_soc; |
|
1625 | - $thirdpartystatic->ref=$objp->socname; |
|
1626 | - $thirdpartystatic->name=$objp->socname; |
|
1624 | + $thirdpartystatic->id = $objp->fk_soc; |
|
1625 | + $thirdpartystatic->ref = $objp->socname; |
|
1626 | + $thirdpartystatic->name = $objp->socname; |
|
1627 | 1627 | print $thirdpartystatic->getNomUrl(1); |
1628 | 1628 | } |
1629 | 1629 | print '</td>'; |
1630 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1630 | + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1631 | 1631 | { |
1632 | 1632 | print '<td align="right">'; |
1633 | 1633 | if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); |
@@ -1641,19 +1641,19 @@ discard block |
||
1641 | 1641 | { |
1642 | 1642 | print '<td align="right">'.$objp->nb.'</td>'; |
1643 | 1643 | |
1644 | - $plannedworkload=$objp->planned_workload; |
|
1645 | - $total_plannedworkload+=$plannedworkload; |
|
1646 | - if (! in_array('plannedworkload', $hiddenfields)) |
|
1644 | + $plannedworkload = $objp->planned_workload; |
|
1645 | + $total_plannedworkload += $plannedworkload; |
|
1646 | + if (!in_array('plannedworkload', $hiddenfields)) |
|
1647 | 1647 | { |
1648 | - print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>'; |
|
1648 | + print '<td align="right">'.($plannedworkload ?convertSecondToTime($plannedworkload) : '').'</td>'; |
|
1649 | 1649 | } |
1650 | - if (! in_array('declaredprogress', $hiddenfields)) |
|
1650 | + if (!in_array('declaredprogress', $hiddenfields)) |
|
1651 | 1651 | { |
1652 | - $declaredprogressworkload=$objp->declared_progess_workload; |
|
1653 | - $total_declaredprogressworkload+=$declaredprogressworkload; |
|
1652 | + $declaredprogressworkload = $objp->declared_progess_workload; |
|
1653 | + $total_declaredprogressworkload += $declaredprogressworkload; |
|
1654 | 1654 | print '<td align="right">'; |
1655 | 1655 | //print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>"; |
1656 | - print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':''); |
|
1656 | + print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : ''); |
|
1657 | 1657 | print '</td>'; |
1658 | 1658 | } |
1659 | 1659 | } |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | |
1672 | 1672 | print '<tr class="liste_total">'; |
1673 | 1673 | print '<td colspan="2">'.$langs->trans("Total")."</td>"; |
1674 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1674 | + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1675 | 1675 | { |
1676 | 1676 | print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>'; |
1677 | 1677 | print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>'; |
@@ -1679,8 +1679,8 @@ discard block |
||
1679 | 1679 | if (empty($conf->global->PROJECT_HIDE_TASKS)) |
1680 | 1680 | { |
1681 | 1681 | print '<td class="liste_total" align="right">'.$total_task.'</td>'; |
1682 | - if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>'; |
|
1683 | - if (! in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>'; |
|
1682 | + if (!in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').'</td>'; |
|
1683 | + if (!in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'</td>'; |
|
1684 | 1684 | } |
1685 | 1685 | print '<td class="liste_total"></td>'; |
1686 | 1686 | print '</tr>'; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup core |
24 | 24 | */ |
25 | 25 | |
26 | -if (! function_exists('json_encode')) |
|
26 | +if (!function_exists('json_encode')) |
|
27 | 27 | { |
28 | 28 | /** |
29 | 29 | * Implement json_encode for PHP that does not have module enabled. |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | { |
50 | 50 | dol_syslog("For better performance, enable the native json in your PHP", LOG_WARNING); |
51 | 51 | |
52 | - $num=0; |
|
52 | + $num = 0; |
|
53 | 53 | if (is_object($elements)) // Count number of properties for an object |
54 | 54 | { |
55 | - foreach($elements as $key => $value) $num++; |
|
55 | + foreach ($elements as $key => $value) $num++; |
|
56 | 56 | } |
57 | 57 | else |
58 | 58 | { |
59 | - $num=count($elements); |
|
59 | + $num = count($elements); |
|
60 | 60 | } |
61 | 61 | //var_dump($num); |
62 | 62 | |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | if (is_numeric(key($elements)) && key($elements) == 0) |
65 | 65 | { |
66 | 66 | // indexed (list) |
67 | - $keysofelements=array_keys($elements); // Elements array mus have key that does not start with 0 and end with num-1, so we will use this later. |
|
67 | + $keysofelements = array_keys($elements); // Elements array mus have key that does not start with 0 and end with num-1, so we will use this later. |
|
68 | 68 | $output = '['; |
69 | 69 | for ($i = 0, $last = ($num - 1); $i < $num; $i++) |
70 | 70 | { |
71 | - if (! isset($elements[$keysofelements[$i]])) continue; |
|
72 | - if (is_array($elements[$keysofelements[$i]]) || is_object($elements[$keysofelements[$i]])) $output.= json_encode($elements[$keysofelements[$i]]); |
|
71 | + if (!isset($elements[$keysofelements[$i]])) continue; |
|
72 | + if (is_array($elements[$keysofelements[$i]]) || is_object($elements[$keysofelements[$i]])) $output .= json_encode($elements[$keysofelements[$i]]); |
|
73 | 73 | else $output .= _val($elements[$keysofelements[$i]]); |
74 | - if ($i !== $last) $output.= ','; |
|
74 | + if ($i !== $last) $output .= ','; |
|
75 | 75 | } |
76 | - $output.= ']'; |
|
76 | + $output .= ']'; |
|
77 | 77 | } |
78 | 78 | else |
79 | 79 | { |
@@ -81,18 +81,18 @@ discard block |
||
81 | 81 | $output = '{'; |
82 | 82 | $last = $num - 1; |
83 | 83 | $i = 0; |
84 | - $tmpelements=array(); |
|
85 | - if (is_array($elements)) $tmpelements=$elements; |
|
86 | - if (is_object($elements)) $tmpelements=get_object_vars($elements); |
|
87 | - foreach($tmpelements as $key => $value) |
|
84 | + $tmpelements = array(); |
|
85 | + if (is_array($elements)) $tmpelements = $elements; |
|
86 | + if (is_object($elements)) $tmpelements = get_object_vars($elements); |
|
87 | + foreach ($tmpelements as $key => $value) |
|
88 | 88 | { |
89 | 89 | $output .= '"'.$key.'":'; |
90 | - if (is_array($value)) $output.= json_encode($value); |
|
90 | + if (is_array($value)) $output .= json_encode($value); |
|
91 | 91 | else $output .= _val($value); |
92 | - if ($i !== $last) $output.= ','; |
|
92 | + if ($i !== $last) $output .= ','; |
|
93 | 93 | ++$i; |
94 | 94 | } |
95 | - $output.= '}'; |
|
95 | + $output .= '}'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // return |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | else return 'null'; |
206 | 206 | } |
207 | 207 | |
208 | -if (! function_exists('json_decode')) |
|
208 | +if (!function_exists('json_decode')) |
|
209 | 209 | { |
210 | 210 | /** |
211 | 211 | * Implement json_decode for PHP that does not support it |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param bool $assoc False return an object, true return an array |
215 | 215 | * @return mixed Object or Array |
216 | 216 | */ |
217 | - function json_decode($json, $assoc=false) |
|
217 | + function json_decode($json, $assoc = false) |
|
218 | 218 | { |
219 | 219 | return dol_json_decode($json, $assoc); |
220 | 220 | } |
@@ -229,40 +229,40 @@ discard block |
||
229 | 229 | * @return mixed Object or Array or false on error |
230 | 230 | * @see json_decode() |
231 | 231 | */ |
232 | -function dol_json_decode($json, $assoc=false) |
|
232 | +function dol_json_decode($json, $assoc = false) |
|
233 | 233 | { |
234 | 234 | dol_syslog("For better performance, enable the native json in your PHP", LOG_WARNING); |
235 | 235 | |
236 | 236 | $comment = false; |
237 | 237 | |
238 | - $out=''; |
|
239 | - $strLength = strlen($json); // Must stay strlen and not dol_strlen because we want technical length, not visible length |
|
240 | - for ($i=0; $i<$strLength; $i++) |
|
238 | + $out = ''; |
|
239 | + $strLength = strlen($json); // Must stay strlen and not dol_strlen because we want technical length, not visible length |
|
240 | + for ($i = 0; $i < $strLength; $i++) |
|
241 | 241 | { |
242 | - if (! $comment) |
|
242 | + if (!$comment) |
|
243 | 243 | { |
244 | - if (($json[$i] == '{') || ($json[$i] == '[')) $out.= 'array('; |
|
245 | - else if (($json[$i] == '}') || ($json[$i] == ']')) $out.= ')'; |
|
246 | - else if ($json[$i] == ':') $out.= ' => '; |
|
247 | - else $out.=$json[$i]; |
|
244 | + if (($json[$i] == '{') || ($json[$i] == '[')) $out .= 'array('; |
|
245 | + else if (($json[$i] == '}') || ($json[$i] == ']')) $out .= ')'; |
|
246 | + else if ($json[$i] == ':') $out .= ' => '; |
|
247 | + else $out .= $json[$i]; |
|
248 | 248 | } |
249 | - else $out.= $json[$i]; |
|
250 | - if ($json[$i] == '"' && $json[($i-1)]!="\\") $comment = !$comment; |
|
249 | + else $out .= $json[$i]; |
|
250 | + if ($json[$i] == '"' && $json[($i - 1)] != "\\") $comment = !$comment; |
|
251 | 251 | } |
252 | 252 | |
253 | - $out=_unval($out); |
|
253 | + $out = _unval($out); |
|
254 | 254 | |
255 | 255 | // Return an array |
256 | 256 | if ($out != '') eval('$array = '.$out.';'); |
257 | - else $array=array(); |
|
257 | + else $array = array(); |
|
258 | 258 | |
259 | 259 | // Return an object |
260 | - if (! $assoc) |
|
260 | + if (!$assoc) |
|
261 | 261 | { |
262 | - if (! empty($array)) |
|
262 | + if (!empty($array)) |
|
263 | 263 | { |
264 | 264 | $object = false; |
265 | - if (count($array)>0) { |
|
265 | + if (count($array) > 0) { |
|
266 | 266 | $object = (object) array(); |
267 | 267 | } |
268 | 268 | foreach ($array as $key => $value) |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | while (preg_match('/\\\u([0-9A-F]{2})([0-9A-F]{2})/i', $val, $reg)) |
291 | 291 | { |
292 | 292 | // single, escaped unicode character |
293 | - $utf16 = chr(hexdec($reg[1])) . chr(hexdec($reg[2])); |
|
293 | + $utf16 = chr(hexdec($reg[1])).chr(hexdec($reg[2])); |
|
294 | 294 | $utf8 = utf162utf8($utf16); |
295 | - $val=preg_replace('/\\\u'.$reg[1].$reg[2].'/i',$utf8,$val); |
|
295 | + $val = preg_replace('/\\\u'.$reg[1].$reg[2].'/i', $utf8, $val); |
|
296 | 296 | } |
297 | 297 | return $val; |
298 | 298 | } |
@@ -310,13 +310,13 @@ discard block |
||
310 | 310 | function utf162utf8($utf16) |
311 | 311 | { |
312 | 312 | // oh please oh please oh please oh please oh please |
313 | - if(function_exists('mb_convert_encoding')) { |
|
313 | + if (function_exists('mb_convert_encoding')) { |
|
314 | 314 | return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); |
315 | 315 | } |
316 | 316 | |
317 | 317 | $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); |
318 | 318 | |
319 | - switch(true) { |
|
319 | + switch (true) { |
|
320 | 320 | case ((0x7F & $bytes) == $bytes): |
321 | 321 | // this case should never be reached, because we are in ASCII range |
322 | 322 | // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | function utf82utf16($utf8) |
354 | 354 | { |
355 | 355 | // oh please oh please oh please oh please oh please |
356 | - if(function_exists('mb_convert_encoding')) { |
|
356 | + if (function_exists('mb_convert_encoding')) { |
|
357 | 357 | return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); |
358 | 358 | } |
359 | 359 | |
360 | - switch(strlen($utf8)) { |
|
360 | + switch (strlen($utf8)) { |
|
361 | 361 | case 1: |
362 | 362 | // this case should never be reached, because we are in ASCII range |
363 | 363 | // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | case 2: |
367 | 367 | // return a UTF-16 character from a 2-byte UTF-8 char |
368 | 368 | // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
369 | - return chr(0x07 & (ord($utf8{0}) >> 2)) . chr((0xC0 & (ord($utf8{0}) << 6)) | (0x3F & ord($utf8{1}))); |
|
369 | + return chr(0x07 & (ord($utf8{0}) >> 2)).chr((0xC0 & (ord($utf8{0}) << 6)) | (0x3F & ord($utf8{1}))); |
|
370 | 370 | |
371 | 371 | case 3: |
372 | 372 | // return a UTF-16 character from a 3-byte UTF-8 char |
373 | 373 | // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
374 | - return chr((0xF0 & (ord($utf8{0}) << 4)) | (0x0F & (ord($utf8{1}) >> 2))) . chr((0xC0 & (ord($utf8{1}) << 6)) | (0x7F & ord($utf8{2}))); |
|
374 | + return chr((0xF0 & (ord($utf8{0}) << 4)) | (0x0F & (ord($utf8{1}) >> 2))).chr((0xC0 & (ord($utf8{1}) << 6)) | (0x7F & ord($utf8{2}))); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | // ignoring UTF-32 for now, sorry |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | * @param int $issupplierline Is it a line for a supplier object ? |
39 | 39 | * @return string String with line |
40 | 40 | */ |
41 | -function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierline=0) |
|
41 | +function doc_getlinedesc($line, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0) |
|
42 | 42 | { |
43 | 43 | global $db, $conf, $langs; |
44 | 44 | |
45 | - $idprod=$line->fk_product; |
|
46 | - $label=(! empty($line->label)?$line->label:(! empty($line->libelle)?$line->libelle:'')); |
|
47 | - $desc=(! empty($line->desc)?$line->desc:(! empty($line->description)?$line->description:'')); |
|
48 | - $ref_supplier=(! empty($line->ref_supplier)?$line->ref_supplier:(! empty($line->ref_fourn)?$line->ref_fourn:'')); // TODO Not yet saved for supplier invoices, only supplier orders |
|
49 | - $note=(! empty($line->note)?$line->note:''); |
|
45 | + $idprod = $line->fk_product; |
|
46 | + $label = (!empty($line->label) ? $line->label : (!empty($line->libelle) ? $line->libelle : '')); |
|
47 | + $desc = (!empty($line->desc) ? $line->desc : (!empty($line->description) ? $line->description : '')); |
|
48 | + $ref_supplier = (!empty($line->ref_supplier) ? $line->ref_supplier : (!empty($line->ref_fourn) ? $line->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders |
|
49 | + $note = (!empty($line->note) ? $line->note : ''); |
|
50 | 50 | |
51 | 51 | if ($issupplierline) $prodser = new ProductFournisseur($db); |
52 | 52 | else $prodser = new Product($db); |
@@ -55,57 +55,57 @@ discard block |
||
55 | 55 | { |
56 | 56 | $prodser->fetch($idprod); |
57 | 57 | // If a predefined product and multilang and on other lang, we renamed label with label translated |
58 | - if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) |
|
58 | + if (!empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) |
|
59 | 59 | { |
60 | - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; |
|
61 | - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; |
|
62 | - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; |
|
60 | + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label = $prodser->multilangs[$outputlangs->defaultlang]["label"]; |
|
61 | + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc = $prodser->multilangs[$outputlangs->defaultlang]["description"]; |
|
62 | + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | 66 | // Description short of product line |
67 | - $libelleproduitservice=$label; |
|
67 | + $libelleproduitservice = $label; |
|
68 | 68 | |
69 | 69 | // Description long of product line |
70 | 70 | if ($desc && ($desc != $label)) |
71 | 71 | { |
72 | 72 | if ($desc == '(CREDIT_NOTE)' && $line->fk_remise_except) |
73 | 73 | { |
74 | - $discount=new DiscountAbsolute($db); |
|
74 | + $discount = new DiscountAbsolute($db); |
|
75 | 75 | $discount->fetch($line->fk_remise_except); |
76 | - $sourceref=!empty($discount->discount_type)?$discount->ref_invoive_supplier_source:$discount->ref_facture_source; |
|
77 | - $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromCreditNote",$sourceref); |
|
76 | + $sourceref = !empty($discount->discount_type) ? $discount->ref_invoive_supplier_source : $discount->ref_facture_source; |
|
77 | + $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromCreditNote", $sourceref); |
|
78 | 78 | } |
79 | 79 | elseif ($desc == '(DEPOSIT)' && $line->fk_remise_except) |
80 | 80 | { |
81 | - $discount=new DiscountAbsolute($db); |
|
81 | + $discount = new DiscountAbsolute($db); |
|
82 | 82 | $discount->fetch($line->fk_remise_except); |
83 | - $sourceref=!empty($discount->discount_type)?$discount->ref_invoive_supplier_source:$discount->ref_facture_source; |
|
84 | - $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$sourceref); |
|
83 | + $sourceref = !empty($discount->discount_type) ? $discount->ref_invoive_supplier_source : $discount->ref_facture_source; |
|
84 | + $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $sourceref); |
|
85 | 85 | // Add date of deposit |
86 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice.=' ('.dol_print_date($discount->datec,'day','',$outputlangs).')'; |
|
86 | + if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice .= ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')'; |
|
87 | 87 | } |
88 | 88 | elseif ($desc == '(EXCESS RECEIVED)' && $line->fk_remise_except) |
89 | 89 | { |
90 | - $discount=new DiscountAbsolute($db); |
|
90 | + $discount = new DiscountAbsolute($db); |
|
91 | 91 | $discount->fetch($line->fk_remise_except); |
92 | - $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromExcessReceived",$discount->ref_facture_source); |
|
92 | + $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromExcessReceived", $discount->ref_facture_source); |
|
93 | 93 | } |
94 | 94 | elseif ($desc == '(EXCESS PAID)' && $line->fk_remise_except) |
95 | 95 | { |
96 | - $discount=new DiscountAbsolute($db); |
|
96 | + $discount = new DiscountAbsolute($db); |
|
97 | 97 | $discount->fetch($line->fk_remise_except); |
98 | - $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromExcessPaid",$discount->ref_invoice_supplier_source); |
|
98 | + $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromExcessPaid", $discount->ref_invoice_supplier_source); |
|
99 | 99 | } |
100 | 100 | else |
101 | 101 | { |
102 | 102 | if ($idprod) |
103 | 103 | { |
104 | - if (empty($hidedesc)) $libelleproduitservice=dol_concatdesc($libelleproduitservice, $desc); |
|
104 | + if (empty($hidedesc)) $libelleproduitservice = dol_concatdesc($libelleproduitservice, $desc); |
|
105 | 105 | } |
106 | 106 | else |
107 | 107 | { |
108 | - $libelleproduitservice=dol_concatdesc($libelleproduitservice, $desc); |
|
108 | + $libelleproduitservice = dol_concatdesc($libelleproduitservice, $desc); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | { |
119 | 119 | $prefix_prodserv = ""; |
120 | 120 | $ref_prodserv = ""; |
121 | - if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this |
|
121 | + if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this |
|
122 | 122 | { |
123 | 123 | if ($prodser->isService()) |
124 | 124 | { |
@@ -132,34 +132,34 @@ discard block |
||
132 | 132 | |
133 | 133 | if (empty($hideref)) |
134 | 134 | { |
135 | - if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref |
|
135 | + if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref |
|
136 | 136 | else $ref_prodserv = $prodser->ref; // Show local ref only |
137 | 137 | |
138 | 138 | $ref_prodserv .= " - "; |
139 | 139 | } |
140 | 140 | |
141 | - $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; |
|
141 | + $libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - if (! empty($line->date_start) || ! empty($line->date_end)) |
|
145 | + if (!empty($line->date_start) || !empty($line->date_end)) |
|
146 | 146 | { |
147 | - $format='day'; |
|
147 | + $format = 'day'; |
|
148 | 148 | // Show duration if exists |
149 | 149 | if ($line->date_start && $line->date_end) |
150 | 150 | { |
151 | - $period='('.$outputlangs->transnoentitiesnoconv('DateFromTo',dol_print_date($line->date_start, $format, false, $outputlangs),dol_print_date($line->date_end, $format, false, $outputlangs)).')'; |
|
151 | + $period = '('.$outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($line->date_start, $format, false, $outputlangs), dol_print_date($line->date_end, $format, false, $outputlangs)).')'; |
|
152 | 152 | } |
153 | - if ($line->date_start && ! $line->date_end) |
|
153 | + if ($line->date_start && !$line->date_end) |
|
154 | 154 | { |
155 | - $period='('.$outputlangs->transnoentitiesnoconv('DateFrom',dol_print_date($line->date_start, $format, false, $outputlangs)).')'; |
|
155 | + $period = '('.$outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($line->date_start, $format, false, $outputlangs)).')'; |
|
156 | 156 | } |
157 | - if (! $line->date_start && $line->date_end) |
|
157 | + if (!$line->date_start && $line->date_end) |
|
158 | 158 | { |
159 | - $period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dol_print_date($line->date_end, $format, false, $outputlangs)).')'; |
|
159 | + $period = '('.$outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($line->date_end, $format, false, $outputlangs)).')'; |
|
160 | 160 | } |
161 | 161 | //print '>'.$outputlangs->charset_output.','.$period; |
162 | - $libelleproduitservice=dol_concatdesc($libelleproduitservice, $period); |
|
162 | + $libelleproduitservice = dol_concatdesc($libelleproduitservice, $period); |
|
163 | 163 | //print $libelleproduitservice; |
164 | 164 | } |
165 | 165 |