Passed
Push — master ( 5adaa9...b51057 )
by
unknown
02:40
created
class/subtotal.class.php 2 patches
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -5,28 +5,28 @@  discard block
 block discarded – undo
5 5
 	
6 6
 	static $module_number = 104777;
7 7
 	
8
-	static function addSubTotalLine(&$object, $label, $qty, $rang=-1) {
8
+	static function addSubTotalLine(&$object, $label, $qty, $rang = -1) {
9 9
 		
10 10
 		$res = 0;
11 11
 		
12
-		if( (float)DOL_VERSION <= 3.4 ) {
12
+		if ((float) DOL_VERSION <= 3.4) {
13 13
 			/**
14 14
 			 * @var $object Facture
15 15
 			 */
16
-			if($object->element=='facture') $res =  $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number);
16
+			if ($object->element == 'facture') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, -1, TSubtotal::$module_number);
17 17
 			/**
18 18
 			 * @var $object Propal
19 19
 			 */
20
-			else if($object->element=='propal') $res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number);
20
+			else if ($object->element == 'propal') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, -1, TSubtotal::$module_number);
21 21
 			/**
22 22
 			 * @var $object Commande
23 23
 			 */
24
-			else if($object->element=='commande') $res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number);
24
+			else if ($object->element == 'commande') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, -1, TSubtotal::$module_number);
25 25
 
26 26
 		}
27 27
 		else {
28 28
 			$desc = '';
29
-			if ((float) DOL_VERSION < 6  || $qty==50) {
29
+			if ((float) DOL_VERSION < 6 || $qty == 50) {
30 30
 				$desc = $label;
31 31
 				$label = '';
32 32
 			}
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 			/**
35 35
 			 * @var $object Facture
36 36
 			 */
37
-			if($object->element=='facture') $res =  $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
37
+			if ($object->element == 'facture') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, $rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
38 38
 			/**
39 39
 			 * @var $object Propal
40 40
 			 */
41
-			else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label);
41
+			else if ($object->element == 'propal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label);
42 42
 			/**
43 43
 			 * @var $object Commande
44 44
 			 */
45
-			else if($object->element=='commande') $res =  $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label);
45
+			else if ($object->element == 'commande') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, $rang, TSubtotal::$module_number, 0, null, 0, $label);
46 46
 			/**
47 47
 			 * @var $object Facturerec
48 48
 			 */
49
-			else if($object->element=='facturerec') $res =  $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); 
49
+			else if ($object->element == 'facturerec') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number, $label); 
50 50
 			
51 51
 		}
52 52
 	
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public static function generateDoc(&$object)
59 59
 	{
60
-		global $conf,$langs,$db;
60
+		global $conf, $langs, $db;
61 61
 		
62 62
 		if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
63 63
 		{
64
-			$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
65
-			$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
66
-			$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
64
+			$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
65
+			$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
66
+			$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
67 67
 			
68 68
 			// Define output language
69 69
 			$outputlangs = $langs;
70 70
 			$newlang = GETPOST('lang_id', 'alpha');
71
-			if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang))
71
+			if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang))
72 72
 				$newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang;
73
-			if (! empty($newlang)) {
73
+			if (!empty($newlang)) {
74 74
 				$outputlangs = new Translate("", $conf);
75 75
 				$outputlangs->setDefaultLang($newlang);
76 76
 			}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			}
85 85
 			else
86 86
 			{
87
-				if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
87
+				if ($object->element != 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
88 88
 			}
89 89
 		}
90 90
 	}
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 	 * @param type $rang_start
97 97
 	 * @param type $move_to
98 98
 	 */
99
-	public static function updateRang(&$object, $rang_start, $move_to=1)
99
+	public static function updateRang(&$object, $rang_start, $move_to = 1)
100 100
 	{
101 101
 		if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
102 102
 		
103
-		$row=new GenericObject($object->db);
103
+		$row = new GenericObject($object->db);
104 104
 		$row->table_element_line = $object->table_element_line;
105 105
 		$row->fk_element = $object->fk_element;
106 106
 		$row->id = $object->id;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		{
110 110
 			if ($line->rang < $rang_start) continue;
111 111
 			
112
-			$row->updateRangOfLine($line->id, $line->rang+$move_to);
112
+			$row->updateRangOfLine($line->id, $line->rang + $move_to);
113 113
 		}
114 114
 	}
115 115
 	
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 			{
139 139
 				if ($rang_to_add != -1) self::updateRang($object, $rang_to_add);
140 140
 				
141
-				self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add);
141
+				self::addSubTotalLine($object, $langs->trans('SubTotal'), 100 - $title_niveau, $rang_to_add);
142 142
 				
143 143
 				$object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas)
144 144
 				if ($rang_to_add != -1) 
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 		}
151 151
 	}
152 152
 	
153
-	public static function addTitle(&$object, $label, $level, $rang=-1)
153
+	public static function addTitle(&$object, $label, $level, $rang = -1)
154 154
 	{
155 155
 		self::addSubTotalLine($object, $label, $level, $rang);
156 156
 	}
157 157
 	
158
-	public static function addTotal(&$object, $label, $level, $rang=-1)
158
+	public static function addTotal(&$object, $label, $level, $rang = -1)
159 159
 	{
160
-		self::addSubTotalLine($object, $label, (100-$level), $rang);
160
+		self::addSubTotalLine($object, $label, (100 - $level), $rang);
161 161
 	}
162 162
 
163 163
 	/**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * 
169 169
 	 * @return array
170 170
 	 */
171
-	public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total=false)
171
+	public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total = false)
172 172
 	{
173 173
 		$TTitle = self::getAllTitleFromDocument($object, $get_block_total);
174 174
 		
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param boolean								$return_rang_on_false	si true alors renvoi le rang où devrait ce trouver le sous-total
190 190
 	 * @return boolean
191 191
 	 */
192
-	public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false)
192
+	public static function titleHasTotalLine(&$object, &$title_line, $strict_mode = false, $return_rang_on_false = false)
193 193
 	{
194 194
 		if (empty($object->lines) || !is_array($object->lines)) return false;
195 195
 		
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		return ($return_rang_on_false) ? -1 : false;
216 216
 	}
217 217
 	
218
-	public static function getAllTitleFromDocument(&$object, $get_block_total=false)
218
+	public static function getAllTitleFromDocument(&$object, $get_block_total = false)
219 219
 	{
220 220
 		$TRes = array();
221 221
 		if (!empty($object->lines))
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 		return false;
336 336
 	}
337 337
 	
338
-	public static function isTitle(&$line, $level=-1)
338
+	public static function isTitle(&$line, $level = -1)
339 339
 	{
340 340
 		$res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9;
341
-		if($res && $level > -1) {
341
+		if ($res && $level > -1) {
342 342
 			return $line->qty == $level;
343 343
 		} else return $res;
344 344
 		
@@ -359,28 +359,28 @@  discard block
 block discarded – undo
359 359
 		return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line);
360 360
 	}
361 361
 
362
-	public static function getFreeTextHtml(&$line, $readonly=0)
362
+	public static function getFreeTextHtml(&$line, $readonly = 0)
363 363
 	{
364 364
 		global $conf;
365 365
 		
366 366
 		// Copie du fichier "objectline_edit.tpl.php"
367 367
 		// editeur wysiwyg
368 368
 		require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
369
-		$nbrows=ROWS_2;
370
-		if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
371
-		$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
372
-		$toolbarname='dolibarr_details';
373
-		if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
374
-		$text = !empty($line->description)?$line->description:$line->label;
375
-		$doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly);
369
+		$nbrows = ROWS_2;
370
+		if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
371
+		$enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
372
+		$toolbarname = 'dolibarr_details';
373
+		if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes';
374
+		$text = !empty($line->description) ? $line->description : $line->label;
375
+		$doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly);
376 376
 		return $doleditor->Create(1);
377 377
 	}
378 378
 	
379
-	public static function duplicateLines(&$object, $lineid, $withBlockLine=false)
379
+	public static function duplicateLines(&$object, $lineid, $withBlockLine = false)
380 380
 	{
381
-		global $db,$user,$conf;
381
+		global $db, $user, $conf;
382 382
 
383
-		if ($object->statut == 0  && $user->rights->{$object->element}->creer && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK))
383
+		if ($object->statut == 0 && $user->rights->{$object->element}->creer && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK))
384 384
 		{
385 385
 			dol_include_once('/subtotal/lib/subtotal.lib.php');
386 386
 			
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 					{
422 422
 						$object->line_from = $line;
423 423
 						// Call trigger
424
-						$result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line
424
+						$result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line
425 425
 						if ($result < 0)
426 426
 						{
427 427
 							$object->db->rollback();
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		}
453 453
 	}
454 454
 	
455
-	public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false)
455
+	public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false)
456 456
 	{
457 457
 		global $langs;
458 458
 		
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 		
465 465
 		$TLine = array();
466 466
 		$add_line = false;
467
-		$under_title_found=false;
467
+		$under_title_found = false;
468 468
 		
469 469
 		foreach ($object->lines as $key => &$line)
470 470
 		{
471 471
 			if (!$under_title_found && !empty($TTitle_under_search))
472 472
 			{
473
-				if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true;
473
+				if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true;
474 474
 			}
475 475
 			else
476 476
 			{
477
-				if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) )))
477
+				if (($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search))))
478 478
 				{
479 479
 					if ($key_is_id) $level = $line->qty;
480 480
 					
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 					if ($withBlockLine) $TLine[] = $line;
483 483
 					continue;
484 484
 				}
485
-				elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre
485
+				elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level)) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre
486 486
 				{
487 487
 					if ($withBlockLine) $TLine[] = $line;
488 488
 					break;
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 				
491 491
 				if ($add_line)
492 492
 				{
493
-					if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue;
493
+					if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue;
494 494
 					else $TLine[] = $line;
495 495
 				}
496 496
 			}
@@ -499,12 +499,12 @@  discard block
 block discarded – undo
499 499
 		return $TLine;
500 500
 	}
501 501
 	
502
-	public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false)
502
+	public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false)
503 503
 	{
504 504
 		return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true);
505 505
 	}
506 506
 	
507
-	public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null)
507
+	public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 0, $fk_unit = null)
508 508
 	{
509 509
 		$res = 0;
510 510
 		$object->db->begin();
@@ -529,9 +529,9 @@  discard block
 block discarded – undo
529 529
 				$factureRecLine->fetch($rowid);
530 530
 				$factureRecLine->array_options = $array_options;
531 531
 				$factureRecLine->insertExtraFields();
532
-				$rang=$factureRecLine->rang;
532
+				$rang = $factureRecLine->rang;
533 533
 				
534
-				$fk_product=0; $fk_remise_except=''; $pu_ttc=0;	
534
+				$fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0;	
535 535
 				$res = $object->updateline($rowid, $desc, $pu, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $info_bits, $fk_remise_except, $pu_ttc, $type, $rang, $special_code, $label, $fk_unit);
536 536
 				break;
537 537
 		}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		global $db, $object;
548 548
 		
549 549
 		$TTitle = array();
550
-		if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {}
550
+		if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {}
551 551
 		else {
552 552
 			if ($origin_line->element == 'propaldet')
553 553
 			{
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 	 */
628 628
 	public static function addRecapPage(&$parameters, &$origin_pdf)
629 629
 	{
630
-		global $user,$conf,$langs;
630
+		global $user, $conf, $langs;
631 631
 		
632 632
 		$origin_file = $parameters['file'];
633 633
 		$outputlangs = $parameters['outputlangs'];
@@ -643,21 +643,21 @@  discard block
 block discarded – undo
643 643
 		$objmarge->marge_droite = 10;
644 644
 		
645 645
 		$objectref = dol_sanitizeFileName($object->ref);
646
-		if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref;
647
-		elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref;
648
-		elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref;
646
+		if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref;
647
+		elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref;
648
+		elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref;
649 649
 		elseif ($object->element == 'facturerec') return; // no PDF for facturerec
650 650
 		else
651 651
 		{
652 652
 			setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings');
653 653
 			return -1;
654 654
 		}
655
-		$file = $dir . '/' . $objectref . '_recap.pdf';
655
+		$file = $dir.'/'.$objectref.'_recap.pdf';
656 656
 
657 657
 //		$pdf=pdf_getInstance($origin_pdf->format);
658
-		$pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait
659
-		$default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
660
-		$pdf->SetAutoPageBreak(1,0);
658
+		$pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait
659
+		$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
660
+		$pdf->SetAutoPageBreak(1, 0);
661 661
 	             
662 662
 		if (class_exists('TCPDF'))
663 663
 		{
@@ -666,49 +666,49 @@  discard block
 block discarded – undo
666 666
 		}
667 667
 		$pdf->SetFont(pdf_getPDFFont($outputlangs));
668 668
 		// Set path to the background PDF File
669
-		if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
669
+		if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
670 670
 		{
671 671
 			$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
672 672
 			$tplidx = $pdf->importPage(1);
673 673
 		}
674 674
 
675 675
 		$pdf->Open();
676
-		$pagenb=0;
677
-		$pdf->SetDrawColor(128,128,128);
676
+		$pagenb = 0;
677
+		$pdf->SetDrawColor(128, 128, 128);
678 678
 
679 679
 		$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
680 680
 		$pdf->SetSubject($outputlangs->transnoentities("subtotalRecap"));
681 681
 		$pdf->SetCreator("Dolibarr ".DOL_VERSION);
682 682
 		$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
683 683
 		$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
684
-		if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
684
+		if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
685 685
 
686
-		$pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite);   // Left, Top, Right
686
+		$pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right
687 687
 
688
-		$pagenb=0;
689
-		$pdf->SetDrawColor(128,128,128);
688
+		$pagenb = 0;
689
+		$pdf->SetDrawColor(128, 128, 128);
690 690
 
691 691
 			
692 692
 		// New page
693 693
 		$pdf->AddPage();
694
-		if (! empty($tplidx)) $pdf->useTemplate($tplidx);
694
+		if (!empty($tplidx)) $pdf->useTemplate($tplidx);
695 695
 		$pagenb++;
696 696
 		
697 697
 		
698 698
 		self::pagehead($objmarge, $pdf, $object, 1, $outputlangs);
699
-		$pdf->SetFont('','', $default_font_size - 1);
700
-		$pdf->MultiCell(0, 3, '');		// Set interline to 3
701
-		$pdf->SetTextColor(0,0,0);
699
+		$pdf->SetFont('', '', $default_font_size - 1);
700
+		$pdf->MultiCell(0, 3, ''); // Set interline to 3
701
+		$pdf->SetTextColor(0, 0, 0);
702 702
 		
703
-		$heightforinfotot = 25;	// Height reserved to output the info and total part
704
-		$heightforfooter = $objmarge->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
703
+		$heightforinfotot = 25; // Height reserved to output the info and total part
704
+		$heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
705 705
 		
706 706
 		$posx_designation = 25;
707 707
 		$posx_options = 150;
708 708
 		$posx_montant = 170;
709 709
 		
710 710
 		$tab_top = 72;
711
-		$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier
711
+		$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier
712 712
 		
713 713
 		$TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array());
714 714
 		
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 			$nexY = $tab_top + 10;
723 723
 			
724 724
 			$nblignes = count($TLine);
725
-			foreach($TLine as $i => &$line)
725
+			foreach ($TLine as $i => &$line)
726 726
 			{
727 727
 				$curY = $nexY;
728 728
 				
729 729
 				if (self::getNiveau($line) == 1) 
730 730
 				{
731
-					$pdf->SetFont('','B', $default_font_size - 1);   // Into loop to work with multipage
732
-					$curY+=2;
731
+					$pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage
732
+					$curY += 2;
733 733
 					
734 734
 					$TTot['total_ht'] += $line->total_ht;
735 735
 					$TTot['total_tva'] += $line->total_tva;
@@ -748,67 +748,67 @@  discard block
 block discarded – undo
748 748
 						$TTot['TTotal_tva_multicurrency'][$tx] += $amount;
749 749
 					}	
750 750
 				}
751
-				else $pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
751
+				else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
752 752
 				
753
-				$pdf->SetTextColor(0,0,0);
753
+				$pdf->SetTextColor(0, 0, 0);
754 754
 				
755 755
 				$pdf->setTopMargin($tab_top_newpage + 10);
756
-				$pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
757
-				$pageposbefore=$pdf->getPage();
756
+				$pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
757
+				$pageposbefore = $pdf->getPage();
758 758
 				
759
-				$showpricebeforepagebreak=1;
759
+				$showpricebeforepagebreak = 1;
760 760
 				
761 761
 				$decalage = (self::getNiveau($line) - 1) * 2;
762 762
 				
763 763
 				// Print: Designation
764 764
 				$label = $line->label;
765
-				if( (float)DOL_VERSION < 6 ) {
765
+				if ((float) DOL_VERSION < 6) {
766 766
 					$label = !empty($line->label) ? $line->label : $line->desc;
767 767
 				}
768 768
 				
769 769
 				
770 770
 				$pdf->startTransaction();
771
-				$pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true);
772
-				$pageposafter=$pdf->getPage();
771
+				$pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true);
772
+				$pageposafter = $pdf->getPage();
773 773
 				if ($pageposafter > $pageposbefore)	// There is a pagebreak
774 774
 				{
775 775
 					$pdf->rollbackTransaction(true);
776
-					$pageposafter=$pageposbefore;
776
+					$pageposafter = $pageposbefore;
777 777
 					//print $pageposafter.'-'.$pageposbefore;exit;
778
-					$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
779
-					$pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true);
778
+					$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
779
+					$pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true);
780 780
 
781
-					$pageposafter=$pdf->getPage();
782
-					$posyafter=$pdf->GetY();
781
+					$pageposafter = $pdf->getPage();
782
+					$posyafter = $pdf->GetY();
783 783
 					//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
784
-					if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot)))	// There is no space left for total+free text
784
+					if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot)))	// There is no space left for total+free text
785 785
 					{
786
-						if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
786
+						if ($i == ($nblignes - 1))	// No more lines, and no space left to show total, so we create a new page
787 787
 						{
788
-							$pdf->AddPage('','',true);
789
-							if (! empty($tplidx)) $pdf->useTemplate($tplidx);
788
+							$pdf->AddPage('', '', true);
789
+							if (!empty($tplidx)) $pdf->useTemplate($tplidx);
790 790
 							if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
791
-							$pdf->setPage($pageposafter+1);
791
+							$pdf->setPage($pageposafter + 1);
792 792
 						}
793 793
 					}
794 794
 					else
795 795
 					{
796 796
 						// We found a page break
797
-						$showpricebeforepagebreak=0;
797
+						$showpricebeforepagebreak = 0;
798 798
 					}
799 799
 				}
800 800
 				else	// No pagebreak
801 801
 				{
802 802
 					$pdf->commitTransaction();
803 803
 				}
804
-				$posYAfterDescription=$pdf->GetY();
804
+				$posYAfterDescription = $pdf->GetY();
805 805
 
806 806
 				$nexY = $pdf->GetY();
807
-				$pageposafter=$pdf->getPage();
807
+				$pageposafter = $pdf->getPage();
808 808
 
809 809
 				$pdf->setPage($pageposbefore);
810 810
 				$pdf->setTopMargin($objmarge->marge_haute);
811
-				$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
811
+				$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
812 812
 
813 813
 				// We suppose that a too long description or photo were moved completely on next page
814 814
 				if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 				if (!empty($line->total_options))
822 822
 				{
823 823
 					$pdf->SetXY($posx_options, $curY);
824
-					$pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0);
824
+					$pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0);
825 825
 				}
826 826
 				
827 827
 				// Print: Montant
828 828
 				$pdf->SetXY($posx_montant, $curY);
829
-				$pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0);
829
+				$pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0);
830 830
 				
831
-				$nexY+=2;    // Passe espace entre les lignes
831
+				$nexY += 2; // Passe espace entre les lignes
832 832
 
833 833
 				// Detect if some page were added automatically and output _tableau for past pages
834 834
 				while ($pagenb < $pageposafter)
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 					
846 846
 					$pagenb++;
847 847
 					$pdf->setPage($pagenb);
848
-					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
848
+					$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
849 849
 					if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
850 850
 				}
851 851
 			}
@@ -855,19 +855,19 @@  discard block
 block discarded – undo
855 855
 		if ($pagenb == 1)
856 856
 		{
857 857
 			self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
858
-			$bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
858
+			$bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
859 859
 		}
860 860
 		else
861 861
 		{
862 862
 			self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
863
-			$bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
863
+			$bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
864 864
 		}
865 865
 		
866 866
 		// Affiche zone totaux
867
-		$posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot);
867
+		$posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot);
868 868
 		
869 869
 		$pdf->Close();
870
-		$pdf->Output($file,'F');
870
+		$pdf->Output($file, 'F');
871 871
 		
872 872
 		$pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file);
873 873
 		
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
 		$level = $line->qty; // TODO à améliorer
880 880
 		
881 881
 		$pdf->SetXY($objmarge->marge_gauche, $curY);
882
-		$pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0);
882
+		$pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0);
883 883
 	}
884 884
 	
885 885
 	/**
@@ -893,50 +893,50 @@  discard block
 block discarded – undo
893 893
 	 */
894 894
 	private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs)
895 895
 	{
896
-		global $conf,$mysoc;
896
+		global $conf, $mysoc;
897 897
 
898 898
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
899 899
 
900
-		pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur);
900
+		pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur);
901 901
 
902
-		$pdf->SetTextColor(0,0,60);
903
-		$pdf->SetFont('','B', $default_font_size + 3);
902
+		$pdf->SetTextColor(0, 0, 60);
903
+		$pdf->SetFont('', 'B', $default_font_size + 3);
904 904
 
905
-		$posy=$objmarge->marge_haute;
906
-		$posx=$objmarge->page_largeur-$objmarge->marge_droite-100;
905
+		$posy = $objmarge->marge_haute;
906
+		$posx = $objmarge->page_largeur - $objmarge->marge_droite - 100;
907 907
 		
908
-		$pdf->SetXY($objmarge->marge_gauche,$posy);
908
+		$pdf->SetXY($objmarge->marge_gauche, $posy);
909 909
 
910
-		$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
910
+		$logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
911 911
 		if ($mysoc->logo)
912 912
 		{
913 913
 			if (is_readable($logo))
914 914
 			{
915
-			    $height=pdf_getHeightForLogo($logo);
916
-			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
915
+			    $height = pdf_getHeightForLogo($logo);
916
+			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto)
917 917
 			}
918 918
 			else
919 919
 			{
920
-				$pdf->SetTextColor(200,0,0);
921
-				$pdf->SetFont('','B',$default_font_size - 2);
922
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
920
+				$pdf->SetTextColor(200, 0, 0);
921
+				$pdf->SetFont('', 'B', $default_font_size - 2);
922
+				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
923 923
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
924 924
 			}
925 925
 			
926
-			$posy+=35;
926
+			$posy += 35;
927 927
 		}
928 928
 		else
929 929
 		{
930
-			$text=$mysoc->name;
930
+			$text = $mysoc->name;
931 931
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
932 932
 			
933
-			$posy+=15;
933
+			$posy += 15;
934 934
 		}
935 935
 		
936 936
 		
937
-		$pdf->SetTextColor(0,0,0);
938
-		$pdf->SetFont('','B', $default_font_size + 2);
939
-		$pdf->SetXY($objmarge->marge_gauche,$posy);
937
+		$pdf->SetTextColor(0, 0, 0);
938
+		$pdf->SetFont('', 'B', $default_font_size + 2);
939
+		$pdf->SetXY($objmarge->marge_gauche, $posy);
940 940
 		
941 941
 		$key = 'subtotalPropalTitle';
942 942
 		if ($object->element == 'commande') $key = 'subtotalCommandeTitle';
@@ -945,14 +945,14 @@  discard block
 block discarded – undo
945 945
 		
946 946
 		$pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L');
947 947
 		
948
-		$pdf->SetFont('','', $default_font_size);
949
-		$pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy);
948
+		$pdf->SetFont('', '', $default_font_size);
949
+		$pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy);
950 950
 		$pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R');
951 951
 		
952 952
 		$posy += 8;
953 953
 			
954
-		$pdf->SetFont('','B', $default_font_size + 2);
955
-		$pdf->SetXY($objmarge->marge_gauche,$posy);
954
+		$pdf->SetFont('', 'B', $default_font_size + 2);
955
+		$pdf->SetXY($objmarge->marge_gauche, $posy);
956 956
 		$pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L');
957 957
 		
958 958
 	}
@@ -970,44 +970,44 @@  discard block
 block discarded – undo
970 970
 	 *   @param		string		$currency		Currency code
971 971
 	 *   @return	void
972 972
 	 */
973
-	private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
973
+	private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
974 974
 	{
975 975
 		global $conf;
976 976
 		
977 977
 		// Force to disable hidetop and hidebottom
978
-		$hidebottom=0;
979
-		if ($hidetop) $hidetop=-1;
978
+		$hidebottom = 0;
979
+		if ($hidetop) $hidetop = -1;
980 980
 
981 981
 		$currency = !empty($currency) ? $currency : $conf->currency;
982 982
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
983 983
 
984 984
 		// Amount in (at tab_top - 1)
985
-		$pdf->SetTextColor(0,0,0);
986
-		$pdf->SetFont('','',$default_font_size);
985
+		$pdf->SetTextColor(0, 0, 0);
986
+		$pdf->SetFont('', '', $default_font_size);
987 987
 
988 988
 		if (empty($hidetop))
989 989
 		{
990
-			$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency));
991
-			$pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5);
990
+			$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
991
+			$pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5);
992 992
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
993 993
 			
994
-			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
994
+			if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite - $objmarge->marge_gauche, 8, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
995 995
 			
996 996
 			
997
-			$pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top);	// line prend une position y en 2eme param et 4eme param
997
+			$pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param
998 998
 
999
-			$pdf->SetXY($posx_designation, $tab_top+2);
1000
-			$pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L');
1001
-			$pdf->SetXY($posx_options, $tab_top+2);
1002
-			$pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R');
1003
-			$pdf->SetXY($posx_montant, $tab_top+2);
1004
-			$pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R');
999
+			$pdf->SetXY($posx_designation, $tab_top + 2);
1000
+			$pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1001
+			$pdf->SetXY($posx_options, $tab_top + 2);
1002
+			$pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R');
1003
+			$pdf->SetXY($posx_montant, $tab_top + 2);
1004
+			$pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R');
1005 1005
 			
1006
-			$pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8);	// line prend une position y en 2eme param et 4eme param
1006
+			$pdf->line($objmarge->marge_gauche, $tab_top + 8, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top + 8); // line prend une position y en 2eme param et 4eme param
1007 1007
 		}
1008 1008
 		else
1009 1009
 		{
1010
-			$pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2);	// line prend une position y en 2eme param et 4eme param
1010
+			$pdf->line($objmarge->marge_gauche, $tab_top - 2, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top - 2); // line prend une position y en 2eme param et 4eme param
1011 1011
 		}
1012 1012
 		
1013 1013
 	}
@@ -1016,29 +1016,29 @@  discard block
 block discarded – undo
1016 1016
 	{
1017 1017
 		global $conf;
1018 1018
 		
1019
-		$pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy);	// line prend une position y en 2eme param et 4eme param
1019
+		$pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param
1020 1020
 		
1021 1021
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1022 1022
 		
1023
-		$tab2_top = $posy+2;
1023
+		$tab2_top = $posy + 2;
1024 1024
 		$tab2_hl = 4;
1025
-		$pdf->SetFont('','', $default_font_size - 1);
1025
+		$pdf->SetFont('', '', $default_font_size - 1);
1026 1026
 
1027 1027
 		// Tableau total
1028 1028
 		$col1x = 120; $col2x = 170;
1029 1029
 		if ($objmarge->page_largeur < 210) // To work with US executive format
1030 1030
 		{
1031
-			$col2x-=20;
1031
+			$col2x -= 20;
1032 1032
 		}
1033 1033
 		$largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x);
1034 1034
 
1035
-		$useborder=0;
1035
+		$useborder = 0;
1036 1036
 		$index = 0;
1037 1037
 
1038 1038
 		// Total HT
1039
-		$pdf->SetFillColor(255,255,255);
1039
+		$pdf->SetFillColor(255, 255, 255);
1040 1040
 		$pdf->SetXY($col1x, $tab2_top + 0);
1041
-		$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
1041
+		$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
1042 1042
 
1043 1043
 		// $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht'];
1044 1044
 		$total_ht = $TTot['total_ht'];
@@ -1046,10 +1046,10 @@  discard block
 block discarded – undo
1046 1046
 		$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1);
1047 1047
 
1048 1048
 		// Show VAT by rates and total
1049
-		$pdf->SetFillColor(248,248,248);
1049
+		$pdf->SetFillColor(248, 248, 248);
1050 1050
 		
1051
-		$atleastoneratenotnull=0;
1052
-		foreach($TTot['TTotal_tva'] as $tvakey => $tvaval)
1051
+		$atleastoneratenotnull = 0;
1052
+		foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval)
1053 1053
 		{
1054 1054
 			if ($tvakey != 0)    // On affiche pas taux 0
1055 1055
 			{
@@ -1058,15 +1058,15 @@  discard block
 block discarded – undo
1058 1058
 				$index++;
1059 1059
 				$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1060 1060
 
1061
-				$tvacompl='';
1062
-				if (preg_match('/\*/',$tvakey))
1061
+				$tvacompl = '';
1062
+				if (preg_match('/\*/', $tvakey))
1063 1063
 				{
1064
-					$tvakey=str_replace('*','',$tvakey);
1064
+					$tvakey = str_replace('*', '', $tvakey);
1065 1065
 					$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1066 1066
 				}
1067
-				$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
1068
-				$totalvat.=vatrate($tvakey,1).$tvacompl;
1069
-				$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1067
+				$totalvat = $outputlangs->transnoentities("TotalVAT").' ';
1068
+				$totalvat .= vatrate($tvakey, 1).$tvacompl;
1069
+				$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1070 1070
 
1071 1071
 				$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1072 1072
 				$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -1076,16 +1076,16 @@  discard block
 block discarded – undo
1076 1076
 		// Total TTC
1077 1077
 		$index++;
1078 1078
 		$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1079
-		$pdf->SetTextColor(0,0,60);
1080
-		$pdf->SetFillColor(224,224,224);
1081
-		$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1079
+		$pdf->SetTextColor(0, 0, 60);
1080
+		$pdf->SetFillColor(224, 224, 224);
1081
+		$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1082 1082
 
1083 1083
 		// $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc'];
1084 1084
 		$total_ttc = $TTot['total_ttc'];
1085 1085
 		$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1086 1086
 		$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1087 1087
 
1088
-		$pdf->SetTextColor(0,0,0);
1088
+		$pdf->SetTextColor(0, 0, 0);
1089 1089
 				
1090 1090
 		$index++;
1091 1091
 		return ($tab2_top + ($tab2_hl * $index));
@@ -1104,22 +1104,22 @@  discard block
 block discarded – undo
1104 1104
 	 * @param	int		$hidebottom		Hide bottom
1105 1105
 	 * @return	void
1106 1106
 	 */
1107
-    private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1107
+    private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1108 1108
     {
1109
-	    if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1110
-	    $pdf->line($x+$l, $y, $x+$l, $y+$h);
1111
-	    if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1112
-	    $pdf->line($x, $y+$h, $x, $y);
1109
+	    if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y);
1110
+	    $pdf->line($x + $l, $y, $x + $l, $y + $h);
1111
+	    if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h);
1112
+	    $pdf->line($x, $y + $h, $x, $y);
1113 1113
     }
1114 1114
 	
1115 1115
 	
1116
-	public static function concat(&$outputlangs, $files, $fileoutput='')
1116
+	public static function concat(&$outputlangs, $files, $fileoutput = '')
1117 1117
 	{
1118 1118
 		global $conf;
1119 1119
 		
1120 1120
 		if (empty($fileoutput)) $fileoutput = $file[0];
1121 1121
 		
1122
-		$pdf=pdf_getInstance();
1122
+		$pdf = pdf_getInstance();
1123 1123
         if (class_exists('TCPDF'))
1124 1124
         {
1125 1125
             $pdf->setPrintHeader(false);
@@ -1127,10 +1127,10 @@  discard block
 block discarded – undo
1127 1127
         }
1128 1128
         $pdf->SetFont(pdf_getPDFFont($outputlangs));
1129 1129
 
1130
-        if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1130
+        if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1131 1131
 
1132 1132
 		
1133
-		foreach($files as $file)
1133
+		foreach ($files as $file)
1134 1134
 		{
1135 1135
 			$pagecount = $pdf->setSourceFile($file);
1136 1136
 			for ($i = 1; $i <= $pagecount; $i++)
@@ -1142,8 +1142,8 @@  discard block
 block discarded – undo
1142 1142
 			}
1143 1143
 		}
1144 1144
 		
1145
-		$pdf->Output($fileoutput,'F');
1146
-		if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK));
1145
+		$pdf->Output($fileoutput, 'F');
1146
+		if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK));
1147 1147
 
1148 1148
 		return $pagecount;
1149 1149
 	}
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 	 */
1157 1157
 	public static function hasNcTitle(&$line)
1158 1158
 	{
1159
-		if(isset($line->has_nc_title)) return $line->has_nc_title;
1159
+		if (isset($line->has_nc_title)) return $line->has_nc_title;
1160 1160
 
1161 1161
 		$TTitle = self::getAllTitleFromLine($line);
1162 1162
 		foreach ($TTitle as &$line_title)
Please login to merge, or discard this patch.
Braces   +263 added lines, -127 removed lines patch added patch discarded remove patch
@@ -13,18 +13,23 @@  discard block
 block discarded – undo
13 13
 			/**
14 14
 			 * @var $object Facture
15 15
 			 */
16
-			if($object->element=='facture') $res =  $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number);
16
+			if($object->element=='facture') {
17
+				$res =  $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number);
18
+			}
17 19
 			/**
18 20
 			 * @var $object Propal
19 21
 			 */
20
-			else if($object->element=='propal') $res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number);
22
+			else if($object->element=='propal') {
23
+				$res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number);
24
+			}
21 25
 			/**
22 26
 			 * @var $object Commande
23 27
 			 */
24
-			else if($object->element=='commande') $res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number);
28
+			else if($object->element=='commande') {
29
+				$res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number);
30
+			}
25 31
 
26
-		}
27
-		else {
32
+		} else {
28 33
 			$desc = '';
29 34
 			if ((float) DOL_VERSION < 6  || $qty==50) {
30 35
 				$desc = $label;
@@ -34,19 +39,27 @@  discard block
 block discarded – undo
34 39
 			/**
35 40
 			 * @var $object Facture
36 41
 			 */
37
-			if($object->element=='facture') $res =  $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
42
+			if($object->element=='facture') {
43
+				$res =  $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
44
+			}
38 45
 			/**
39 46
 			 * @var $object Propal
40 47
 			 */
41
-			else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label);
48
+			else if($object->element=='propal') {
49
+				$res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label);
50
+			}
42 51
 			/**
43 52
 			 * @var $object Commande
44 53
 			 */
45
-			else if($object->element=='commande') $res =  $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label);
54
+			else if($object->element=='commande') {
55
+				$res =  $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label);
56
+			}
46 57
 			/**
47 58
 			 * @var $object Facturerec
48 59
 			 */
49
-			else if($object->element=='facturerec') $res =  $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); 
60
+			else if($object->element=='facturerec') {
61
+				$res =  $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label);
62
+			}
50 63
 			
51 64
 		}
52 65
 	
@@ -68,8 +81,9 @@  discard block
 block discarded – undo
68 81
 			// Define output language
69 82
 			$outputlangs = $langs;
70 83
 			$newlang = GETPOST('lang_id', 'alpha');
71
-			if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang))
72
-				$newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang;
84
+			if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
85
+							$newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang;
86
+			}
73 87
 			if (! empty($newlang)) {
74 88
 				$outputlangs = new Translate("", $conf);
75 89
 				$outputlangs->setDefaultLang($newlang);
@@ -78,13 +92,18 @@  discard block
 block discarded – undo
78 92
 			$ret = $object->fetch($object->id); // Reload to get new records
79 93
 			if ((float) DOL_VERSION <= 3.6)
80 94
 			{
81
-				if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
82
-				elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
83
-				elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
84
-			}
85
-			else
95
+				if ($object->element == 'propal') {
96
+					propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
97
+				} elseif ($object->element == 'commande') {
98
+					commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
99
+				} elseif ($object->element == 'facture') {
100
+					facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
101
+				}
102
+			} else
86 103
 			{
87
-				if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
104
+				if ($object->element!= 'facturerec') {
105
+					$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
106
+				}
88 107
 			}
89 108
 		}
90 109
 	}
@@ -98,7 +117,9 @@  discard block
 block discarded – undo
98 117
 	 */
99 118
 	public static function updateRang(&$object, $rang_start, $move_to=1)
100 119
 	{
101
-		if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
120
+		if (!class_exists('GenericObject')) {
121
+			require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
122
+		}
102 123
 		
103 124
 		$row=new GenericObject($object->db);
104 125
 		$row->table_element_line = $object->table_element_line;
@@ -107,7 +128,9 @@  discard block
 block discarded – undo
107 128
 		
108 129
 		foreach ($object->lines as &$line)
109 130
 		{
110
-			if ($line->rang < $rang_start) continue;
131
+			if ($line->rang < $rang_start) {
132
+				continue;
133
+			}
111 134
 			
112 135
 			$row->updateRangOfLine($line->id, $line->rang+$move_to);
113 136
 		}
@@ -130,21 +153,28 @@  discard block
 block discarded – undo
130 153
 		foreach ($TTitle_reverse as $k => $title_line)
131 154
 		{
132 155
 			$title_niveau = self::getNiveau($title_line);
133
-			if ($title_niveau < $level_new_title) break;
156
+			if ($title_niveau < $level_new_title) {
157
+				break;
158
+			}
134 159
 			
135 160
 			$rang_to_add = self::titleHasTotalLine($object, $title_line, true, true);
136 161
 			
137 162
 			if (is_numeric($rang_to_add)) 
138 163
 			{
139
-				if ($rang_to_add != -1) self::updateRang($object, $rang_to_add);
164
+				if ($rang_to_add != -1) {
165
+					self::updateRang($object, $rang_to_add);
166
+				}
140 167
 				
141 168
 				self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add);
142 169
 				
143 170
 				$object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas)
144 171
 				if ($rang_to_add != -1) 
145 172
 				{
146
-					if (method_exists($object, 'fetch_lines')) $object->fetch_lines();
147
-					else $object->fetch($object->id);
173
+					if (method_exists($object, 'fetch_lines')) {
174
+						$object->fetch_lines();
175
+					} else {
176
+						$object->fetch($object->id);
177
+					}
148 178
 				}
149 179
 			}
150 180
 		}
@@ -174,7 +204,9 @@  discard block
 block discarded – undo
174 204
 		
175 205
 		foreach ($TTitle as $k => $title_line)
176 206
 		{
177
-			if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]);
207
+			if (self::titleHasTotalLine($object, $title_line)) {
208
+				unset($TTitle[$k]);
209
+			}
178 210
 		}
179 211
 		
180 212
 		return $TTitle;
@@ -191,23 +223,41 @@  discard block
 block discarded – undo
191 223
 	 */
192 224
 	public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false)
193 225
 	{
194
-		if (empty($object->lines) || !is_array($object->lines)) return false;
226
+		if (empty($object->lines) || !is_array($object->lines)) {
227
+			return false;
228
+		}
195 229
 		
196 230
 		$title_niveau = self::getNiveau($title_line);
197 231
 		foreach ($object->lines as &$line)
198 232
 		{
199
-			if ($line->rang <= $title_line->rang) continue;
200
-			if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) return false; // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence
201
-			if (!self::isSubtotal($line)) continue;
233
+			if ($line->rang <= $title_line->rang) {
234
+				continue;
235
+			}
236
+			if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) {
237
+				return false;
238
+			}
239
+			// Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence
240
+			if (!self::isSubtotal($line)) {
241
+				continue;
242
+			}
202 243
 			
203 244
 			$subtotal_niveau = self::getNiveau($line);
204 245
 			
205 246
 			// Comparaison du niveau de la ligne de sous-total avec celui du titre
206
-			if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total
207
-			elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3)
247
+			if ($subtotal_niveau == $title_niveau) {
248
+				return true;
249
+			}
250
+			// niveau égale => Ok mon titre a un sous-total
251
+			elseif ($subtotal_niveau < $title_niveau) {
252
+				// niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3)
208 253
 			{
209
-				if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux
210
-				else return true; // mode libre => OK je considère que mon titre à un sous-total
254
+				if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false;
255
+			}
256
+			// mode strict niveau pas égale donc faux
257
+				else {
258
+					return true;
259
+				}
260
+				// mode libre => OK je considère que mon titre à un sous-total
211 261
 			}
212 262
 		}
213 263
 		
@@ -255,16 +305,19 @@  discard block
 block discarded – undo
255 305
 		
256 306
 		foreach ($object->lines as &$l)
257 307
 		{
258
-			if ($l->rang <= $line->rang) continue;
259
-			elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) break;
260
-			elseif (self::isModSubtotalLine($l)) continue;
308
+			if ($l->rang <= $line->rang) {
309
+				continue;
310
+			} elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) {
311
+				break;
312
+			} elseif (self::isModSubtotalLine($l)) {
313
+				continue;
314
+			}
261 315
 			
262 316
 			if (!empty($l->array_options['options_subtotal_nc']))
263 317
 			{
264 318
 				$tabprice = calcul_price_total($l->qty, $l->subprice, $l->remise_percent, $l->tva_tx, $l->localtax1_tx, $l->localtax2_tx, 0, 'HT', $l->info_bits, $l->product_type);
265 319
 				$TTot['total_options'] += $tabprice[0]; // total ht
266
-			}
267
-			else
320
+			} else
268 321
 			{
269 322
 				$TTot['total_pa_ht'] += $l->pa_ht * $l->qty;
270 323
 				$TTot['total_ht'] += $l->total_ht;
@@ -283,29 +336,41 @@  discard block
 block discarded – undo
283 336
 
284 337
 	public static function getOrderIdFromLineId(&$db, $fk_commandedet)
285 338
 	{
286
-		if (empty($fk_commandedet)) return false;
339
+		if (empty($fk_commandedet)) {
340
+			return false;
341
+		}
287 342
 		
288 343
 		$sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet;
289 344
 		$resql = $db->query($sql);
290 345
 		
291
-		if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande;
292
-		else return false;
346
+		if ($resql && ($row = $db->fetch_object($resql))) {
347
+			return $row->fk_commande;
348
+		} else {
349
+			return false;
350
+		}
293 351
 	}
294 352
 	
295 353
 	public static function getLastLineOrderId(&$db, $fk_commande)
296 354
 	{
297
-		if (empty($fk_commande)) return false;
355
+		if (empty($fk_commande)) {
356
+			return false;
357
+		}
298 358
 		
299 359
 		$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1';
300 360
 		$resql = $db->query($sql);
301 361
 		
302
-		if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid;
303
-		else return false;
362
+		if ($resql && ($row = $db->fetch_object($resql))) {
363
+			return $row->rowid;
364
+		} else {
365
+			return false;
366
+		}
304 367
 	}
305 368
 	
306 369
 	public static function getParentTitleOfLine(&$object, $i)
307 370
 	{
308
-		if ($i <= 0) return false;
371
+		if ($i <= 0) {
372
+			return false;
373
+		}
309 374
 		
310 375
 		$skip_title = 0;
311 376
 		// Je parcours les lignes précédentes
@@ -324,8 +389,7 @@  discard block
 block discarded – undo
324 389
 				//@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total
325 390
 				return $line;
326 391
 				break;
327
-			}
328
-			elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99)
392
+			} elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99)
329 393
 			{
330 394
 				// Il s'agit d'un sous-total, ça veut dire que le prochain titre théoriquement doit être ignorer (je travail avec un incrément au cas ou je croise plusieurs sous-totaux)
331 395
 				$skip_title++;
@@ -340,7 +404,9 @@  discard block
 block discarded – undo
340 404
 		$res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9;
341 405
 		if($res && $level > -1) {
342 406
 			return $line->qty == $level;
343
-		} else return $res;
407
+		} else {
408
+			return $res;
409
+		}
344 410
 		
345 411
 	}
346 412
 	
@@ -367,10 +433,14 @@  discard block
 block discarded – undo
367 433
 		// editeur wysiwyg
368 434
 		require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
369 435
 		$nbrows=ROWS_2;
370
-		if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
436
+		if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
437
+			$nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
438
+		}
371 439
 		$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
372 440
 		$toolbarname='dolibarr_details';
373
-		if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
441
+		if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) {
442
+			$toolbarname='dolibarr_notes';
443
+		}
374 444
 		$text = !empty($line->description)?$line->description:$line->label;
375 445
 		$doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly);
376 446
 		return $doleditor->Create(1);
@@ -416,8 +486,9 @@  discard block
 block discarded – undo
416 486
 
417 487
 					$TLineAdded[] = $object->line;
418 488
 					// Error from addline
419
-					if ($res <= 0) break;
420
-					else
489
+					if ($res <= 0) {
490
+						break;
491
+					} else
421 492
 					{
422 493
 						$object->line_from = $line;
423 494
 						// Call trigger
@@ -440,8 +511,7 @@  discard block
 block discarded – undo
440 511
 				{
441 512
 					$object->db->commit();
442 513
 					return count($TLine);
443
-				}
444
-				else
514
+				} else
445 515
 				{
446 516
 					$object->db->rollback();
447 517
 					return -1;
@@ -457,10 +527,14 @@  discard block
 block discarded – undo
457 527
 		global $langs;
458 528
 		
459 529
 		// Besoin de comparer sur les 2 formes d'écriture
460
-		if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad));
530
+		if (!$key_is_id) {
531
+			$TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad));
532
+		}
461 533
 		
462 534
 		$TTitle_under_search = array();
463
-		if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title));
535
+		if (!empty($under_title)) {
536
+			$TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title));
537
+		}
464 538
 		
465 539
 		$TLine = array();
466 540
 		$add_line = false;
@@ -470,28 +544,37 @@  discard block
 block discarded – undo
470 544
 		{
471 545
 			if (!$under_title_found && !empty($TTitle_under_search))
472 546
 			{
473
-				if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true;
474
-			}
475
-			else
547
+				if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) {
548
+					$under_title_found = true;
549
+				}
550
+			} else
476 551
 			{
477 552
 				if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) )))
478 553
 				{
479
-					if ($key_is_id) $level = $line->qty;
554
+					if ($key_is_id) {
555
+						$level = $line->qty;
556
+					}
480 557
 					
481 558
 					$add_line = true;
482
-					if ($withBlockLine) $TLine[] = $line;
559
+					if ($withBlockLine) {
560
+						$TLine[] = $line;
561
+					}
483 562
 					continue;
484
-				}
485
-				elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre
563
+				} elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) {
564
+					// Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre
486 565
 				{
487 566
 					if ($withBlockLine) $TLine[] = $line;
567
+				}
488 568
 					break;
489 569
 				}
490 570
 				
491 571
 				if ($add_line)
492 572
 				{
493
-					if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue;
494
-					else $TLine[] = $line;
573
+					if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) {
574
+						continue;
575
+					} else {
576
+						$TLine[] = $line;
577
+					}
495 578
 				}
496 579
 			}
497 580
 		}
@@ -536,8 +619,11 @@  discard block
 block discarded – undo
536 619
 				break;
537 620
 		}
538 621
 		
539
-		if ($res <= 0) $object->db->rollback();
540
-		else $object->db->commit();
622
+		if ($res <= 0) {
623
+			$object->db->rollback();
624
+		} else {
625
+			$object->db->commit();
626
+		}
541 627
 		
542 628
 		return $res;
543 629
 	}
@@ -547,24 +633,20 @@  discard block
 block discarded – undo
547 633
 		global $db, $object;
548 634
 		
549 635
 		$TTitle = array();
550
-		if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {}
551
-		else {
636
+		if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else {
552 637
 			if ($origin_line->element == 'propaldet')
553 638
 			{
554 639
 				$object = new Propal($db);
555 640
 				$object->fetch($origin_line->fk_propal);
556
-			}
557
-			else if ($origin_line->element == 'commandedet')
641
+			} else if ($origin_line->element == 'commandedet')
558 642
 			{
559 643
 				$object = new Commande($db);
560 644
 				$object->fetch($origin_line->fk_commande);
561
-			}
562
-			else if ($origin_line->element == 'facturedet')
645
+			} else if ($origin_line->element == 'facturedet')
563 646
 			{
564 647
 				$object = new Facture($db);
565 648
 				$object->fetch($origin_line->fk_facture);
566
-			}
567
-			else
649
+			} else
568 650
 			{
569 651
 				return $TTitle;
570 652
 			}
@@ -574,8 +656,11 @@  discard block
 block discarded – undo
574 656
 		$i = 0;
575 657
 		foreach ($object->lines as &$line)
576 658
 		{
577
-			if ($origin_line->id == $line->id) break;
578
-			else $i++;
659
+			if ($origin_line->id == $line->id) {
660
+				break;
661
+			} else {
662
+				$i++;
663
+			}
579 664
 		}
580 665
 		
581 666
 		$i--; // Skip la ligne d'origine
@@ -590,35 +675,43 @@  discard block
 block discarded – undo
590 675
 				if (self::isSubtotal($object->lines[$y]))
591 676
 				{
592 677
 					$next_title_lvl_to_skip = self::getNiveau($object->lines[$y]);
593
-				}
594
-				elseif (self::isTitle($object->lines[$y]))
678
+				} elseif (self::isTitle($object->lines[$y]))
595 679
 				{
596 680
 					if ($object->lines[$y]->qty == $next_title_lvl_to_skip)
597 681
 					{
598 682
 						$next_title_lvl_to_skip = 0;
599 683
 						continue;
600
-					}
601
-					else
684
+					} else
602 685
 					{
603
-						if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals();
686
+						if (empty($object->lines[$y]->array_options)) {
687
+							$object->lines[$y]->fetch_optionals();
688
+						}
604 689
 						$TTitle[$object->lines[$y]->id] = $object->lines[$y];
605 690
 						
606
-						if ($object->lines[$y]->qty == 1) break;
691
+						if ($object->lines[$y]->qty == 1) {
692
+							break;
693
+						}
607 694
 					}
608 695
 				}
609 696
 			}
610 697
 		}
611 698
 		
612
-		if ($reverse) $TTitle = array_reverse($TTitle, true);
699
+		if ($reverse) {
700
+			$TTitle = array_reverse($TTitle, true);
701
+		}
613 702
 		
614 703
 		return $TTitle;
615 704
 	}
616 705
 	
617 706
 	public static function getNiveau(&$line)
618 707
 	{
619
-		if (self::isTitle($line)) return $line->qty;
620
-		elseif (self::isSubtotal($line)) return 100 - $line->qty;
621
-		else return 0;
708
+		if (self::isTitle($line)) {
709
+			return $line->qty;
710
+		} elseif (self::isSubtotal($line)) {
711
+			return 100 - $line->qty;
712
+		} else {
713
+			return 0;
714
+		}
622 715
 	}
623 716
 	
624 717
 	/**
@@ -643,10 +736,16 @@  discard block
 block discarded – undo
643 736
 		$objmarge->marge_droite = 10;
644 737
 		
645 738
 		$objectref = dol_sanitizeFileName($object->ref);
646
-		if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref;
647
-		elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref;
648
-		elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref;
649
-		elseif ($object->element == 'facturerec') return; // no PDF for facturerec
739
+		if ($object->element == 'propal') {
740
+			$dir = $conf->propal->dir_output . '/' . $objectref;
741
+		} elseif ($object->element == 'commande') {
742
+			$dir = $conf->commande->dir_output . '/' . $objectref;
743
+		} elseif ($object->element == 'facture') {
744
+			$dir = $conf->facture->dir_output . '/' . $objectref;
745
+		} elseif ($object->element == 'facturerec') {
746
+			return;
747
+		}
748
+		// no PDF for facturerec
650 749
 		else
651 750
 		{
652 751
 			setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings');
@@ -681,7 +780,9 @@  discard block
 block discarded – undo
681 780
 		$pdf->SetCreator("Dolibarr ".DOL_VERSION);
682 781
 		$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
683 782
 		$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
684
-		if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
783
+		if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
784
+			$pdf->SetCompression(false);
785
+		}
685 786
 
686 787
 		$pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite);   // Left, Top, Right
687 788
 
@@ -691,7 +792,9 @@  discard block
 block discarded – undo
691 792
 			
692 793
 		// New page
693 794
 		$pdf->AddPage();
694
-		if (! empty($tplidx)) $pdf->useTemplate($tplidx);
795
+		if (! empty($tplidx)) {
796
+			$pdf->useTemplate($tplidx);
797
+		}
695 798
 		$pagenb++;
696 799
 		
697 800
 		
@@ -747,8 +850,10 @@  discard block
 block discarded – undo
747 850
 					{
748 851
 						$TTot['TTotal_tva_multicurrency'][$tx] += $amount;
749 852
 					}	
853
+				} else {
854
+					$pdf->SetFont('','', $default_font_size - 1);
750 855
 				}
751
-				else $pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
856
+				// Into loop to work with multipage
752 857
 				
753 858
 				$pdf->SetTextColor(0,0,0);
754 859
 				
@@ -770,9 +875,11 @@  discard block
 block discarded – undo
770 875
 				$pdf->startTransaction();
771 876
 				$pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true);
772 877
 				$pageposafter=$pdf->getPage();
773
-				if ($pageposafter > $pageposbefore)	// There is a pagebreak
878
+				if ($pageposafter > $pageposbefore) {
879
+					// There is a pagebreak
774 880
 				{
775 881
 					$pdf->rollbackTransaction(true);
882
+				}
776 883
 					$pageposafter=$pageposbefore;
777 884
 					//print $pageposafter.'-'.$pageposbefore;exit;
778 885
 					$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
@@ -781,23 +888,27 @@  discard block
 block discarded – undo
781 888
 					$pageposafter=$pdf->getPage();
782 889
 					$posyafter=$pdf->GetY();
783 890
 					//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
784
-					if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot)))	// There is no space left for total+free text
891
+					if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) {
892
+						// There is no space left for total+free text
785 893
 					{
786 894
 						if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
787 895
 						{
788 896
 							$pdf->AddPage('','',true);
789
-							if (! empty($tplidx)) $pdf->useTemplate($tplidx);
790
-							if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
897
+					}
898
+							if (! empty($tplidx)) {
899
+								$pdf->useTemplate($tplidx);
900
+							}
901
+							if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
902
+								self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
903
+							}
791 904
 							$pdf->setPage($pageposafter+1);
792 905
 						}
793
-					}
794
-					else
906
+					} else
795 907
 					{
796 908
 						// We found a page break
797 909
 						$showpricebeforepagebreak=0;
798 910
 					}
799
-				}
800
-				else	// No pagebreak
911
+				} else	// No pagebreak
801 912
 				{
802 913
 					$pdf->commitTransaction();
803 914
 				}
@@ -837,8 +948,7 @@  discard block
 block discarded – undo
837 948
 					if ($pagenb == 1)
838 949
 					{
839 950
 						self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
840
-					}
841
-					else
951
+					} else
842 952
 					{
843 953
 						self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
844 954
 					}
@@ -846,7 +956,9 @@  discard block
 block discarded – undo
846 956
 					$pagenb++;
847 957
 					$pdf->setPage($pagenb);
848 958
 					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
849
-					if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
959
+					if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
960
+						self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
961
+					}
850 962
 				}
851 963
 			}
852 964
 		}
@@ -856,8 +968,7 @@  discard block
 block discarded – undo
856 968
 		{
857 969
 			self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
858 970
 			$bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
859
-		}
860
-		else
971
+		} else
861 972
 		{
862 973
 			self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
863 974
 			$bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
@@ -871,7 +982,9 @@  discard block
 block discarded – undo
871 982
 		
872 983
 		$pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file);
873 984
 		
874
-		if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file);
985
+		if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) {
986
+			unlink($file);
987
+		}
875 988
 	}
876 989
 	
877 990
 	private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation)
@@ -914,8 +1027,7 @@  discard block
 block discarded – undo
914 1027
 			{
915 1028
 			    $height=pdf_getHeightForLogo($logo);
916 1029
 			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
917
-			}
918
-			else
1030
+			} else
919 1031
 			{
920 1032
 				$pdf->SetTextColor(200,0,0);
921 1033
 				$pdf->SetFont('','B',$default_font_size - 2);
@@ -924,8 +1036,7 @@  discard block
 block discarded – undo
924 1036
 			}
925 1037
 			
926 1038
 			$posy+=35;
927
-		}
928
-		else
1039
+		} else
929 1040
 		{
930 1041
 			$text=$mysoc->name;
931 1042
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
@@ -939,9 +1050,13 @@  discard block
 block discarded – undo
939 1050
 		$pdf->SetXY($objmarge->marge_gauche,$posy);
940 1051
 		
941 1052
 		$key = 'subtotalPropalTitle';
942
-		if ($object->element == 'commande') $key = 'subtotalCommandeTitle';
943
-		elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle';
944
-		elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle';
1053
+		if ($object->element == 'commande') {
1054
+			$key = 'subtotalCommandeTitle';
1055
+		} elseif ($object->element == 'facture') {
1056
+			$key = 'subtotalInvoiceTitle';
1057
+		} elseif ($object->element == 'facturerec') {
1058
+			$key = 'subtotalInvoiceTitle';
1059
+		}
945 1060
 		
946 1061
 		$pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L');
947 1062
 		
@@ -976,7 +1091,9 @@  discard block
 block discarded – undo
976 1091
 		
977 1092
 		// Force to disable hidetop and hidebottom
978 1093
 		$hidebottom=0;
979
-		if ($hidetop) $hidetop=-1;
1094
+		if ($hidetop) {
1095
+			$hidetop=-1;
1096
+		}
980 1097
 
981 1098
 		$currency = !empty($currency) ? $currency : $conf->currency;
982 1099
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -991,7 +1108,9 @@  discard block
 block discarded – undo
991 1108
 			$pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5);
992 1109
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
993 1110
 			
994
-			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1111
+			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1112
+				$pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1113
+			}
995 1114
 			
996 1115
 			
997 1116
 			$pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top);	// line prend une position y en 2eme param et 4eme param
@@ -1004,8 +1123,7 @@  discard block
 block discarded – undo
1004 1123
 			$pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R');
1005 1124
 			
1006 1125
 			$pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8);	// line prend une position y en 2eme param et 4eme param
1007
-		}
1008
-		else
1126
+		} else
1009 1127
 		{
1010 1128
 			$pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2);	// line prend une position y en 2eme param et 4eme param
1011 1129
 		}
@@ -1026,10 +1144,12 @@  discard block
 block discarded – undo
1026 1144
 
1027 1145
 		// Tableau total
1028 1146
 		$col1x = 120; $col2x = 170;
1029
-		if ($objmarge->page_largeur < 210) // To work with US executive format
1147
+		if ($objmarge->page_largeur < 210) {
1148
+			// To work with US executive format
1030 1149
 		{
1031 1150
 			$col2x-=20;
1032 1151
 		}
1152
+		}
1033 1153
 		$largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x);
1034 1154
 
1035 1155
 		$useborder=0;
@@ -1051,9 +1171,11 @@  discard block
 block discarded – undo
1051 1171
 		$atleastoneratenotnull=0;
1052 1172
 		foreach($TTot['TTotal_tva'] as $tvakey => $tvaval)
1053 1173
 		{
1054
-			if ($tvakey != 0)    // On affiche pas taux 0
1174
+			if ($tvakey != 0) {
1175
+				// On affiche pas taux 0
1055 1176
 			{
1056 1177
 				$atleastoneratenotnull++;
1178
+			}
1057 1179
 
1058 1180
 				$index++;
1059 1181
 				$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@@ -1106,9 +1228,13 @@  discard block
 block discarded – undo
1106 1228
 	 */
1107 1229
     private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1108 1230
     {
1109
-	    if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1231
+	    if (empty($hidetop) || $hidetop==-1) {
1232
+	    	$pdf->line($x, $y, $x+$l, $y);
1233
+	    }
1110 1234
 	    $pdf->line($x+$l, $y, $x+$l, $y+$h);
1111
-	    if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1235
+	    if (empty($hidebottom)) {
1236
+	    	$pdf->line($x+$l, $y+$h, $x, $y+$h);
1237
+	    }
1112 1238
 	    $pdf->line($x, $y+$h, $x, $y);
1113 1239
     }
1114 1240
 	
@@ -1117,7 +1243,9 @@  discard block
 block discarded – undo
1117 1243
 	{
1118 1244
 		global $conf;
1119 1245
 		
1120
-		if (empty($fileoutput)) $fileoutput = $file[0];
1246
+		if (empty($fileoutput)) {
1247
+			$fileoutput = $file[0];
1248
+		}
1121 1249
 		
1122 1250
 		$pdf=pdf_getInstance();
1123 1251
         if (class_exists('TCPDF'))
@@ -1127,7 +1255,9 @@  discard block
 block discarded – undo
1127 1255
         }
1128 1256
         $pdf->SetFont(pdf_getPDFFont($outputlangs));
1129 1257
 
1130
-        if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1258
+        if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
1259
+        	$pdf->SetCompression(false);
1260
+        }
1131 1261
 
1132 1262
 		
1133 1263
 		foreach($files as $file)
@@ -1143,7 +1273,9 @@  discard block
 block discarded – undo
1143 1273
 		}
1144 1274
 		
1145 1275
 		$pdf->Output($fileoutput,'F');
1146
-		if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK));
1276
+		if (! empty($conf->global->MAIN_UMASK)) {
1277
+			@chmod($file, octdec($conf->global->MAIN_UMASK));
1278
+		}
1147 1279
 
1148 1280
 		return $pagecount;
1149 1281
 	}
@@ -1156,7 +1288,9 @@  discard block
 block discarded – undo
1156 1288
 	 */
1157 1289
 	public static function hasNcTitle(&$line)
1158 1290
 	{
1159
-		if(isset($line->has_nc_title)) return $line->has_nc_title;
1291
+		if(isset($line->has_nc_title)) {
1292
+			return $line->has_nc_title;
1293
+		}
1160 1294
 
1161 1295
 		$TTitle = self::getAllTitleFromLine($line);
1162 1296
 		foreach ($TTitle as &$line_title)
@@ -1181,7 +1315,9 @@  discard block
 block discarded – undo
1181 1315
 	public static function getTitleLabel($line)
1182 1316
 	{
1183 1317
 		$title = $line->label;
1184
-		if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc;
1318
+		if (empty($title)) {
1319
+			$title = !empty($line->description) ? $line->description : $line->desc;
1320
+		}
1185 1321
 		return $title;
1186 1322
 	}
1187 1323
 }
Please login to merge, or discard this patch.
core/modules/modSubtotal.class.php 2 patches
Indentation   +380 added lines, -380 removed lines patch added patch discarded remove patch
@@ -31,170 +31,170 @@  discard block
 block discarded – undo
31 31
 class modSubtotal extends DolibarrModules
32 32
 {
33 33
 
34
-    /**
35
-     * 	Constructor. Define names, constants, directories, boxes, permissions
36
-     *
37
-     * 	@param	DoliDB		$db	Database handler
38
-     */
34
+	/**
35
+	 * 	Constructor. Define names, constants, directories, boxes, permissions
36
+	 *
37
+	 * 	@param	DoliDB		$db	Database handler
38
+	 */
39 39
      
40
-    public function __construct($db)
41
-    {
42
-        global $langs, $conf;
40
+	public function __construct($db)
41
+	{
42
+		global $langs, $conf;
43 43
 
44
-        $this->db = $db;
44
+		$this->db = $db;
45 45
 
46 46
 		$this->editor_name = 'ATM-Consulting';
47
-        // Id for module (must be unique).
48
-        // Use a free id here
49
-        // (See in Home -> System information -> Dolibarr for list of used modules id).
50
-        $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
-        // Key text used to identify module (for permissions, menus, etc...)
52
-        $this->rights_class = 'subtotal';
47
+		// Id for module (must be unique).
48
+		// Use a free id here
49
+		// (See in Home -> System information -> Dolibarr for list of used modules id).
50
+		$this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
+		// Key text used to identify module (for permissions, menus, etc...)
52
+		$this->rights_class = 'subtotal';
53 53
 
54
-        // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
-        // It is used to group modules in module setup page
56
-        $this->family = "technic";
57
-        // Module label (no space allowed)
58
-        // used if translation string 'ModuleXXXName' not found
59
-        // (where XXX is value of numeric property 'numero' of module)
60
-        $this->name = preg_replace('/^mod/i', '', get_class($this));
61
-        // Module description
62
-        // used if translation string 'ModuleXXXDesc' not found
63
-        // (where XXX is value of numeric property 'numero' of module)
64
-        $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
-        // Possible values for version are: 'development', 'experimental' or version
66
-        $this->version = '3.0.1';
67
-        // Key used in llx_const table to save module status enabled/disabled
68
-        // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
-        // Where to store the module in setup page
71
-        // (0=common,1=interface,2=others,3=very specific)
72
-        $this->special = 2;
73
-        // Name of image file used for this module.
74
-        // If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
-        // use this->picto='pictovalue'
76
-        // If file is in module/img directory under name object_pictovalue.png
77
-        // use this->picto='pictovalue@module'
78
-        $this->picto = 'subtotal@subtotal'; // mypicto@titre
79
-        // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
-        // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
-        // for specific path of parts (eg: /titre/core/modules/barcode)
82
-        // for specific css file (eg: /titre/css/titre.css.php)
83
-        $this->module_parts = array(
84
-            // Set this to 1 if module has its own trigger directory
85
-            'triggers' => 1,
86
-            // Set this to 1 if module has its own login method directory
87
-            //'login' => 0,
88
-            // Set this to 1 if module has its own substitution function file
89
-            //'substitutions' => 0,
90
-            // Set this to 1 if module has its own menus handler directory
91
-            //'menus' => 0,
92
-            // Set this to 1 if module has its own barcode directory
93
-            //'barcode' => 0,
94
-            // Set this to 1 if module has its own models directory
95
-            'models' => 1,
96
-            // Set this to relative path of css if module has its own css file
97
-            //'css' => '/titre/css/mycss.css.php',
98
-            // Set here all hooks context managed by module
99
-            'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
100
-            // Set here all workflow context managed by module
101
-            //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
-        );
54
+		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
+		// It is used to group modules in module setup page
56
+		$this->family = "technic";
57
+		// Module label (no space allowed)
58
+		// used if translation string 'ModuleXXXName' not found
59
+		// (where XXX is value of numeric property 'numero' of module)
60
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
61
+		// Module description
62
+		// used if translation string 'ModuleXXXDesc' not found
63
+		// (where XXX is value of numeric property 'numero' of module)
64
+		$this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
+		// Possible values for version are: 'development', 'experimental' or version
66
+		$this->version = '3.0.1';
67
+		// Key used in llx_const table to save module status enabled/disabled
68
+		// (where MYMODULE is value of property name of module in uppercase)
69
+		$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
+		// Where to store the module in setup page
71
+		// (0=common,1=interface,2=others,3=very specific)
72
+		$this->special = 2;
73
+		// Name of image file used for this module.
74
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
+		// use this->picto='pictovalue'
76
+		// If file is in module/img directory under name object_pictovalue.png
77
+		// use this->picto='pictovalue@module'
78
+		$this->picto = 'subtotal@subtotal'; // mypicto@titre
79
+		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
+		// for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
+		// for specific path of parts (eg: /titre/core/modules/barcode)
82
+		// for specific css file (eg: /titre/css/titre.css.php)
83
+		$this->module_parts = array(
84
+			// Set this to 1 if module has its own trigger directory
85
+			'triggers' => 1,
86
+			// Set this to 1 if module has its own login method directory
87
+			//'login' => 0,
88
+			// Set this to 1 if module has its own substitution function file
89
+			//'substitutions' => 0,
90
+			// Set this to 1 if module has its own menus handler directory
91
+			//'menus' => 0,
92
+			// Set this to 1 if module has its own barcode directory
93
+			//'barcode' => 0,
94
+			// Set this to 1 if module has its own models directory
95
+			'models' => 1,
96
+			// Set this to relative path of css if module has its own css file
97
+			//'css' => '/titre/css/mycss.css.php',
98
+			// Set here all hooks context managed by module
99
+			'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
100
+			// Set here all workflow context managed by module
101
+			//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
+		);
103 103
 
104
-        // Data directories to create when module is enabled.
105
-        // Example: this->dirs = array("/titre/temp");
106
-        $this->dirs = array();
104
+		// Data directories to create when module is enabled.
105
+		// Example: this->dirs = array("/titre/temp");
106
+		$this->dirs = array();
107 107
 
108
-        // Config pages. Put here list of php pages
109
-        // stored into titre/admin directory, used to setup module.
110
-        $this->config_page_url = array("subtotal_setup.php@subtotal");
108
+		// Config pages. Put here list of php pages
109
+		// stored into titre/admin directory, used to setup module.
110
+		$this->config_page_url = array("subtotal_setup.php@subtotal");
111 111
 
112
-        // Dependencies
113
-        // List of modules id that must be enabled if this module is enabled
114
-        $this->depends = array();
112
+		// Dependencies
113
+		// List of modules id that must be enabled if this module is enabled
114
+		$this->depends = array();
115 115
 
116 116
 		$this->conflictwith=array('modMilestone');
117
-        // List of modules id to disable if this one is disabled
118
-        $this->requiredby = array();
119
-        // Minimum version of PHP required by module
120
-        $this->phpmin = array(5, 3);
121
-        // Minimum version of Dolibarr required by module
122
-        $this->need_dolibarr_version = array(3, 2);
123
-        $this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
-        // Constants
125
-        // List of particular constants to add when module is enabled
126
-        // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
-        // Example:
128
-        $this->const = array(
129
-            	0=>array(
130
-            		'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
-            		'chaine',
132
-            		'I',
133
-            		'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
-            		1
135
-            	)
117
+		// List of modules id to disable if this one is disabled
118
+		$this->requiredby = array();
119
+		// Minimum version of PHP required by module
120
+		$this->phpmin = array(5, 3);
121
+		// Minimum version of Dolibarr required by module
122
+		$this->need_dolibarr_version = array(3, 2);
123
+		$this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
+		// Constants
125
+		// List of particular constants to add when module is enabled
126
+		// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
+		// Example:
128
+		$this->const = array(
129
+				0=>array(
130
+					'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
+					'chaine',
132
+					'I',
133
+					'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
+					1
135
+				)
136 136
 				,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux')
137 137
 				,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux')
138 138
 				,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux')
139 139
 				,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU')
140 140
 				,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B')
141
-            //	1=>array(
142
-            //		'MYMODULE_MYNEWCONST2',
143
-            //		'chaine',
144
-            //		'myvalue',
145
-            //		'This is another constant to add',
146
-            //		0
147
-            //	)
148
-        );
141
+			//	1=>array(
142
+			//		'MYMODULE_MYNEWCONST2',
143
+			//		'chaine',
144
+			//		'myvalue',
145
+			//		'This is another constant to add',
146
+			//		0
147
+			//	)
148
+		);
149 149
 		
150 150
 
151 151
 
152 152
 
153
-        // Array to add new pages in new tabs
154
-        // Example:
155
-        $this->tabs = array(
156
-            //	// To add a new tab identified by code tabname1
157
-            //	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
-            //	// To add another new tab identified by code tabname2
159
-            //	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
-            //	// To remove an existing tab identified by code tabname
161
-            //	'objecttype:-tabname'
162
-        );
163
-        // where objecttype can be
164
-        // 'thirdparty'			to add a tab in third party view
165
-        // 'intervention'		to add a tab in intervention view
166
-        // 'order_supplier'		to add a tab in supplier order view
167
-        // 'invoice_supplier'	to add a tab in supplier invoice view
168
-        // 'invoice'			to add a tab in customer invoice view
169
-        // 'order'				to add a tab in customer order view
170
-        // 'product'			to add a tab in product view
171
-        // 'stock'				to add a tab in stock view
172
-        // 'propal'				to add a tab in propal view
173
-        // 'member'				to add a tab in fundation member view
174
-        // 'contract'			to add a tab in contract view
175
-        // 'user'				to add a tab in user view
176
-        // 'group'				to add a tab in group view
177
-        // 'contact'			to add a tab in contact view
178
-        // 'categories_x'		to add a tab in category view
179
-        // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
-        // Dictionnaries
181
-        if (! isset($conf->subtotal->enabled)) {
182
-            $conf->subtotal=new stdClass();
183
-            $conf->subtotal->enabled = 0;
184
-        }
185
-        $this->dictionaries = array(
153
+		// Array to add new pages in new tabs
154
+		// Example:
155
+		$this->tabs = array(
156
+			//	// To add a new tab identified by code tabname1
157
+			//	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
+			//	// To add another new tab identified by code tabname2
159
+			//	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
+			//	// To remove an existing tab identified by code tabname
161
+			//	'objecttype:-tabname'
162
+		);
163
+		// where objecttype can be
164
+		// 'thirdparty'			to add a tab in third party view
165
+		// 'intervention'		to add a tab in intervention view
166
+		// 'order_supplier'		to add a tab in supplier order view
167
+		// 'invoice_supplier'	to add a tab in supplier invoice view
168
+		// 'invoice'			to add a tab in customer invoice view
169
+		// 'order'				to add a tab in customer order view
170
+		// 'product'			to add a tab in product view
171
+		// 'stock'				to add a tab in stock view
172
+		// 'propal'				to add a tab in propal view
173
+		// 'member'				to add a tab in fundation member view
174
+		// 'contract'			to add a tab in contract view
175
+		// 'user'				to add a tab in user view
176
+		// 'group'				to add a tab in group view
177
+		// 'contact'			to add a tab in contact view
178
+		// 'categories_x'		to add a tab in category view
179
+		// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
+		// Dictionnaries
181
+		if (! isset($conf->subtotal->enabled)) {
182
+			$conf->subtotal=new stdClass();
183
+			$conf->subtotal->enabled = 0;
184
+		}
185
+		$this->dictionaries = array(
186 186
 			'langs'=>'subtotal@subtotal',
187
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
190
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
191
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
195
-            'tabcond'=>array($conf->subtotal->enabled)	
187
+			'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
+			'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
+			'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
190
+			'tabsqlsort'=>array('label ASC'),																					// Sort order
191
+			'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
+			'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
+			'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
+			'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
195
+			'tabcond'=>array($conf->subtotal->enabled)	
196 196
 		);
197
-        /* Example:
197
+		/* Example:
198 198
           // This is to avoid warnings
199 199
           if (! isset($conf->titre->enabled)) $conf->titre->enabled=0;
200 200
           $this->dictionnaries=array(
@@ -235,223 +235,223 @@  discard block
 block discarded – undo
235 235
           );
236 236
          */
237 237
 
238
-        // Boxes
239
-        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
-        $this->boxes = array(); // Boxes list
238
+		// Boxes
239
+		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
+		$this->boxes = array(); // Boxes list
241 241
        
242
-        /*
242
+		/*
243 243
           $this->boxes[$r][1] = "myboxb.php";
244 244
           $r++;
245 245
          */
246 246
 
247
-        // Permissions
248
-        $this->rights = array(); // Permission array used by this module
249
-        $r = 0;
247
+		// Permissions
248
+		$this->rights = array(); // Permission array used by this module
249
+		$r = 0;
250 250
 
251
-        // Add here list of permission defined by
252
-        // an id, a label, a boolean and two constant strings.
253
-        // Example:
254
-        //// Permission id (must not be already used)
255
-        //$this->rights[$r][0] = 2000;
256
-        //// Permission label
257
-        //$this->rights[$r][1] = 'Permision label';
258
-        //// Permission by default for new user (0/1)
259
-        //$this->rights[$r][3] = 1;
260
-        //// In php code, permission will be checked by test
261
-        //// if ($user->rights->permkey->level1->level2)
262
-        //$this->rights[$r][4] = 'level1';
263
-        //// In php code, permission will be checked by test
264
-        //// if ($user->rights->permkey->level1->level2)
265
-        //$this->rights[$r][5] = 'level2';
266
-        //$r++;
267
-        // Main menu entries
268
-        $this->menus = array(); // List of menus to add
269
-        $r = 0;
251
+		// Add here list of permission defined by
252
+		// an id, a label, a boolean and two constant strings.
253
+		// Example:
254
+		//// Permission id (must not be already used)
255
+		//$this->rights[$r][0] = 2000;
256
+		//// Permission label
257
+		//$this->rights[$r][1] = 'Permision label';
258
+		//// Permission by default for new user (0/1)
259
+		//$this->rights[$r][3] = 1;
260
+		//// In php code, permission will be checked by test
261
+		//// if ($user->rights->permkey->level1->level2)
262
+		//$this->rights[$r][4] = 'level1';
263
+		//// In php code, permission will be checked by test
264
+		//// if ($user->rights->permkey->level1->level2)
265
+		//$this->rights[$r][5] = 'level2';
266
+		//$r++;
267
+		// Main menu entries
268
+		$this->menus = array(); // List of menus to add
269
+		$r = 0;
270 270
 
271
-        // Add here entries to declare new menus
272
-        //
273
-        // Example to declare a new Top Menu entry and its Left menu entry:
274
-        //$this->menu[$r]=array(
275
-        //	// Put 0 if this is a top menu
276
-        //	'fk_menu'=>0,
277
-        //	// This is a Top menu entry
278
-        //	'type'=>'top',
279
-        //	'titre'=>'titre top menu',
280
-        //	'mainmenu'=>'titre',
281
-        //	'leftmenu'=>'titre',
282
-        //	'url'=>'/titre/pagetop.php',
283
-        //	// Lang file to use (without .lang) by module.
284
-        //	// File must be in langs/code_CODE/ directory.
285
-        //	'langs'=>'mylangfile',
286
-        //	'position'=>100,
287
-        //	// Define condition to show or hide menu entry.
288
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
-        //	'enabled'=>'$conf->titre->enabled',
290
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
-        //	// if you want your menu with a permission rules
292
-        //	'perms'=>'1',
293
-        //	'target'=>'',
294
-        //	// 0=Menu for internal users, 1=external users, 2=both
295
-        //	'user'=>2
296
-        //);
297
-        //$r++;
298
-        //$this->menu[$r]=array(
299
-        //	// Use r=value where r is index key used for the parent menu entry
300
-        //	// (higher parent must be a top menu entry)
301
-        //	'fk_menu'=>'r=0',
302
-        //	// This is a Left menu entry
303
-        //	'type'=>'left',
304
-        //	'titre'=>'titre left menu',
305
-        //	'mainmenu'=>'titre',
306
-        //	'leftmenu'=>'titre',
307
-        //	'url'=>'/titre/pagelevel1.php',
308
-        //	// Lang file to use (without .lang) by module.
309
-        //	// File must be in langs/code_CODE/ directory.
310
-        //	'langs'=>'mylangfile',
311
-        //	'position'=>100,
312
-        //	// Define condition to show or hide menu entry.
313
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
-        //	'enabled'=>'$conf->titre->enabled',
315
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
-        //	// if you want your menu with a permission rules
317
-        //	'perms'=>'1',
318
-        //	'target'=>'',
319
-        //	// 0=Menu for internal users, 1=external users, 2=both
320
-        //	'user'=>2
321
-        //);
322
-        //$r++;
323
-        //
324
-        // Example to declare a Left Menu entry into an existing Top menu entry:
325
-        //$this->menu[$r]=array(
326
-        //	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
-        //	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
-        //	// This is a Left menu entry
329
-        //	'type'=>'left',
330
-        //	'titre'=>'titre left menu',
331
-        //	'mainmenu'=>'mainmenucode',
332
-        //	'leftmenu'=>'titre',
333
-        //	'url'=>'/titre/pagelevel2.php',
334
-        //	// Lang file to use (without .lang) by module.
335
-        //	// File must be in langs/code_CODE/ directory.
336
-        //	'langs'=>'mylangfile',
337
-        //	'position'=>100,
338
-        //	// Define condition to show or hide menu entry.
339
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
-        //	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
-        //	'enabled'=>'$conf->titre->enabled',
342
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
-        //	// if you want your menu with a permission rules
344
-        //	'perms'=>'1',
345
-        //	'target'=>'',
346
-        //	// 0=Menu for internal users, 1=external users, 2=both
347
-        //	'user'=>2
348
-        //);
349
-        //$r++;
350
-        // Exports
351
-        $r = 1;
271
+		// Add here entries to declare new menus
272
+		//
273
+		// Example to declare a new Top Menu entry and its Left menu entry:
274
+		//$this->menu[$r]=array(
275
+		//	// Put 0 if this is a top menu
276
+		//	'fk_menu'=>0,
277
+		//	// This is a Top menu entry
278
+		//	'type'=>'top',
279
+		//	'titre'=>'titre top menu',
280
+		//	'mainmenu'=>'titre',
281
+		//	'leftmenu'=>'titre',
282
+		//	'url'=>'/titre/pagetop.php',
283
+		//	// Lang file to use (without .lang) by module.
284
+		//	// File must be in langs/code_CODE/ directory.
285
+		//	'langs'=>'mylangfile',
286
+		//	'position'=>100,
287
+		//	// Define condition to show or hide menu entry.
288
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
+		//	'enabled'=>'$conf->titre->enabled',
290
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
+		//	// if you want your menu with a permission rules
292
+		//	'perms'=>'1',
293
+		//	'target'=>'',
294
+		//	// 0=Menu for internal users, 1=external users, 2=both
295
+		//	'user'=>2
296
+		//);
297
+		//$r++;
298
+		//$this->menu[$r]=array(
299
+		//	// Use r=value where r is index key used for the parent menu entry
300
+		//	// (higher parent must be a top menu entry)
301
+		//	'fk_menu'=>'r=0',
302
+		//	// This is a Left menu entry
303
+		//	'type'=>'left',
304
+		//	'titre'=>'titre left menu',
305
+		//	'mainmenu'=>'titre',
306
+		//	'leftmenu'=>'titre',
307
+		//	'url'=>'/titre/pagelevel1.php',
308
+		//	// Lang file to use (without .lang) by module.
309
+		//	// File must be in langs/code_CODE/ directory.
310
+		//	'langs'=>'mylangfile',
311
+		//	'position'=>100,
312
+		//	// Define condition to show or hide menu entry.
313
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
+		//	'enabled'=>'$conf->titre->enabled',
315
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
+		//	// if you want your menu with a permission rules
317
+		//	'perms'=>'1',
318
+		//	'target'=>'',
319
+		//	// 0=Menu for internal users, 1=external users, 2=both
320
+		//	'user'=>2
321
+		//);
322
+		//$r++;
323
+		//
324
+		// Example to declare a Left Menu entry into an existing Top menu entry:
325
+		//$this->menu[$r]=array(
326
+		//	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
+		//	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
+		//	// This is a Left menu entry
329
+		//	'type'=>'left',
330
+		//	'titre'=>'titre left menu',
331
+		//	'mainmenu'=>'mainmenucode',
332
+		//	'leftmenu'=>'titre',
333
+		//	'url'=>'/titre/pagelevel2.php',
334
+		//	// Lang file to use (without .lang) by module.
335
+		//	// File must be in langs/code_CODE/ directory.
336
+		//	'langs'=>'mylangfile',
337
+		//	'position'=>100,
338
+		//	// Define condition to show or hide menu entry.
339
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
+		//	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
+		//	'enabled'=>'$conf->titre->enabled',
342
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
+		//	// if you want your menu with a permission rules
344
+		//	'perms'=>'1',
345
+		//	'target'=>'',
346
+		//	// 0=Menu for internal users, 1=external users, 2=both
347
+		//	'user'=>2
348
+		//);
349
+		//$r++;
350
+		// Exports
351
+		$r = 1;
352 352
 
353
-        // Example:
354
-        //$this->export_code[$r]=$this->rights_class.'_'.$r;
355
-        //// Translation key (used only if key ExportDataset_xxx_z not found)
356
-        //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
-        //// Condition to show export in list (ie: '$user->id==3').
358
-        //// Set to 1 to always show when module is enabled.
359
-        //$this->export_enabled[$r]='1';
360
-        //$this->export_permission[$r]=array(array("facture","facture","export"));
361
-        //$this->export_fields_array[$r]=array(
362
-        //	's.rowid'=>"IdCompany",
363
-        //	's.nom'=>'CompanyName',
364
-        //	's.address'=>'Address',
365
-        //	's.cp'=>'Zip',
366
-        //	's.ville'=>'Town',
367
-        //	's.fk_pays'=>'Country',
368
-        //	's.tel'=>'Phone',
369
-        //	's.siren'=>'ProfId1',
370
-        //	's.siret'=>'ProfId2',
371
-        //	's.ape'=>'ProfId3',
372
-        //	's.idprof4'=>'ProfId4',
373
-        //	's.code_compta'=>'CustomerAccountancyCode',
374
-        //	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
-        //	'f.rowid'=>"InvoiceId",
376
-        //	'f.facnumber'=>"InvoiceRef",
377
-        //	'f.datec'=>"InvoiceDateCreation",
378
-        //	'f.datef'=>"DateInvoice",
379
-        //	'f.total'=>"TotalHT",
380
-        //	'f.total_ttc'=>"TotalTTC",
381
-        //	'f.tva'=>"TotalVAT",
382
-        //	'f.paye'=>"InvoicePaid",
383
-        //	'f.fk_statut'=>'InvoiceStatus',
384
-        //	'f.note'=>"InvoiceNote",
385
-        //	'fd.rowid'=>'LineId',
386
-        //	'fd.description'=>"LineDescription",
387
-        //	'fd.price'=>"LineUnitPrice",
388
-        //	'fd.tva_tx'=>"LineVATRate",
389
-        //	'fd.qty'=>"LineQty",
390
-        //	'fd.total_ht'=>"LineTotalHT",
391
-        //	'fd.total_tva'=>"LineTotalTVA",
392
-        //	'fd.total_ttc'=>"LineTotalTTC",
393
-        //	'fd.date_start'=>"DateStart",
394
-        //	'fd.date_end'=>"DateEnd",
395
-        //	'fd.fk_product'=>'ProductId',
396
-        //	'p.ref'=>'ProductRef'
397
-        //);
398
-        //$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
-        //	's.nom'=>'company',
400
-        //	's.address'=>'company',
401
-        //	's.cp'=>'company',
402
-        //	's.ville'=>'company',
403
-        //	's.fk_pays'=>'company',
404
-        //	's.tel'=>'company',
405
-        //	's.siren'=>'company',
406
-        //	's.siret'=>'company',
407
-        //	's.ape'=>'company',
408
-        //	's.idprof4'=>'company',
409
-        //	's.code_compta'=>'company',
410
-        //	's.code_compta_fournisseur'=>'company',
411
-        //	'f.rowid'=>"invoice",
412
-        //	'f.facnumber'=>"invoice",
413
-        //	'f.datec'=>"invoice",
414
-        //	'f.datef'=>"invoice",
415
-        //	'f.total'=>"invoice",
416
-        //	'f.total_ttc'=>"invoice",
417
-        //	'f.tva'=>"invoice",
418
-        //	'f.paye'=>"invoice",
419
-        //	'f.fk_statut'=>'invoice',
420
-        //	'f.note'=>"invoice",
421
-        //	'fd.rowid'=>'invoice_line',
422
-        //	'fd.description'=>"invoice_line",
423
-        //	'fd.price'=>"invoice_line",
424
-        //	'fd.total_ht'=>"invoice_line",
425
-        //	'fd.total_tva'=>"invoice_line",
426
-        //	'fd.total_ttc'=>"invoice_line",
427
-        //	'fd.tva_tx'=>"invoice_line",
428
-        //	'fd.qty'=>"invoice_line",
429
-        //	'fd.date_start'=>"invoice_line",
430
-        //	'fd.date_end'=>"invoice_line",
431
-        //	'fd.fk_product'=>'product',
432
-        //	'p.ref'=>'product'
433
-        //);
434
-        //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
-        //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
-        //	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
-        //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
-        //	. 'product as p on (fd.fk_product = p.rowid)';
439
-        //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
-        //	. 'AND f.rowid = fd.fk_facture';
441
-        //$r++;
442
-    }
353
+		// Example:
354
+		//$this->export_code[$r]=$this->rights_class.'_'.$r;
355
+		//// Translation key (used only if key ExportDataset_xxx_z not found)
356
+		//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
+		//// Condition to show export in list (ie: '$user->id==3').
358
+		//// Set to 1 to always show when module is enabled.
359
+		//$this->export_enabled[$r]='1';
360
+		//$this->export_permission[$r]=array(array("facture","facture","export"));
361
+		//$this->export_fields_array[$r]=array(
362
+		//	's.rowid'=>"IdCompany",
363
+		//	's.nom'=>'CompanyName',
364
+		//	's.address'=>'Address',
365
+		//	's.cp'=>'Zip',
366
+		//	's.ville'=>'Town',
367
+		//	's.fk_pays'=>'Country',
368
+		//	's.tel'=>'Phone',
369
+		//	's.siren'=>'ProfId1',
370
+		//	's.siret'=>'ProfId2',
371
+		//	's.ape'=>'ProfId3',
372
+		//	's.idprof4'=>'ProfId4',
373
+		//	's.code_compta'=>'CustomerAccountancyCode',
374
+		//	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
+		//	'f.rowid'=>"InvoiceId",
376
+		//	'f.facnumber'=>"InvoiceRef",
377
+		//	'f.datec'=>"InvoiceDateCreation",
378
+		//	'f.datef'=>"DateInvoice",
379
+		//	'f.total'=>"TotalHT",
380
+		//	'f.total_ttc'=>"TotalTTC",
381
+		//	'f.tva'=>"TotalVAT",
382
+		//	'f.paye'=>"InvoicePaid",
383
+		//	'f.fk_statut'=>'InvoiceStatus',
384
+		//	'f.note'=>"InvoiceNote",
385
+		//	'fd.rowid'=>'LineId',
386
+		//	'fd.description'=>"LineDescription",
387
+		//	'fd.price'=>"LineUnitPrice",
388
+		//	'fd.tva_tx'=>"LineVATRate",
389
+		//	'fd.qty'=>"LineQty",
390
+		//	'fd.total_ht'=>"LineTotalHT",
391
+		//	'fd.total_tva'=>"LineTotalTVA",
392
+		//	'fd.total_ttc'=>"LineTotalTTC",
393
+		//	'fd.date_start'=>"DateStart",
394
+		//	'fd.date_end'=>"DateEnd",
395
+		//	'fd.fk_product'=>'ProductId',
396
+		//	'p.ref'=>'ProductRef'
397
+		//);
398
+		//$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
+		//	's.nom'=>'company',
400
+		//	's.address'=>'company',
401
+		//	's.cp'=>'company',
402
+		//	's.ville'=>'company',
403
+		//	's.fk_pays'=>'company',
404
+		//	's.tel'=>'company',
405
+		//	's.siren'=>'company',
406
+		//	's.siret'=>'company',
407
+		//	's.ape'=>'company',
408
+		//	's.idprof4'=>'company',
409
+		//	's.code_compta'=>'company',
410
+		//	's.code_compta_fournisseur'=>'company',
411
+		//	'f.rowid'=>"invoice",
412
+		//	'f.facnumber'=>"invoice",
413
+		//	'f.datec'=>"invoice",
414
+		//	'f.datef'=>"invoice",
415
+		//	'f.total'=>"invoice",
416
+		//	'f.total_ttc'=>"invoice",
417
+		//	'f.tva'=>"invoice",
418
+		//	'f.paye'=>"invoice",
419
+		//	'f.fk_statut'=>'invoice',
420
+		//	'f.note'=>"invoice",
421
+		//	'fd.rowid'=>'invoice_line',
422
+		//	'fd.description'=>"invoice_line",
423
+		//	'fd.price'=>"invoice_line",
424
+		//	'fd.total_ht'=>"invoice_line",
425
+		//	'fd.total_tva'=>"invoice_line",
426
+		//	'fd.total_ttc'=>"invoice_line",
427
+		//	'fd.tva_tx'=>"invoice_line",
428
+		//	'fd.qty'=>"invoice_line",
429
+		//	'fd.date_start'=>"invoice_line",
430
+		//	'fd.date_end'=>"invoice_line",
431
+		//	'fd.fk_product'=>'product',
432
+		//	'p.ref'=>'product'
433
+		//);
434
+		//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
+		//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
+		//	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
+		//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
+		//	. 'product as p on (fd.fk_product = p.rowid)';
439
+		//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
+		//	. 'AND f.rowid = fd.fk_facture';
441
+		//$r++;
442
+	}
443 443
 
444
-    /**
445
-     * Function called when module is enabled.
446
-     * The init function add constants, boxes, permissions and menus
447
-     * (defined in constructor) into Dolibarr database.
448
-     * It also creates data directories
449
-     *
450
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
-     * 	@return		int					1 if OK, 0 if KO
452
-     */
453
-    public function init($options = '')
454
-    {
444
+	/**
445
+	 * Function called when module is enabled.
446
+	 * The init function add constants, boxes, permissions and menus
447
+	 * (defined in constructor) into Dolibarr database.
448
+	 * It also creates data directories
449
+	 *
450
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
+	 * 	@return		int					1 if OK, 0 if KO
452
+	 */
453
+	public function init($options = '')
454
+	{
455 455
 	  	global $conf;
456 456
 		
457 457
 		
@@ -459,39 +459,39 @@  discard block
 block discarded – undo
459 459
 			exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant.");
460 460
 		}
461 461
       */
462
-	    $sql = array();
462
+		$sql = array();
463 463
 
464
-        $result = $this->loadTables();
464
+		$result = $this->loadTables();
465 465
 
466 466
 		
467
-        return $this->_init($sql, $options);
468
-    }
467
+		return $this->_init($sql, $options);
468
+	}
469 469
 
470
-    /**
471
-     * Function called when module is disabled.
472
-     * Remove from database constants, boxes and permissions from Dolibarr database.
473
-     * Data directories are not deleted
474
-     *
475
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
476
-     * 	@return		int					1 if OK, 0 if KO
477
-     */
478
-    public function remove($options = '')
479
-    {
480
-        $sql = array();
470
+	/**
471
+	 * Function called when module is disabled.
472
+	 * Remove from database constants, boxes and permissions from Dolibarr database.
473
+	 * Data directories are not deleted
474
+	 *
475
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
476
+	 * 	@return		int					1 if OK, 0 if KO
477
+	 */
478
+	public function remove($options = '')
479
+	{
480
+		$sql = array();
481 481
 
482
-        return $this->_remove($sql, $options);
483
-    }
482
+		return $this->_remove($sql, $options);
483
+	}
484 484
 
485
-    /**
486
-     * Create tables, keys and data required by module
487
-     * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
488
-     * and create data commands must be stored in directory /titre/sql/
489
-     * This function is called by this->init
490
-     *
491
-     * 	@return		int		<=0 if KO, >0 if OK
492
-     */
493
-    private function loadTables()
494
-    {
495
-        return $this->_load_tables('/subtotal/sql/');
496
-    }
485
+	/**
486
+	 * Create tables, keys and data required by module
487
+	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
488
+	 * and create data commands must be stored in directory /titre/sql/
489
+	 * This function is called by this->init
490
+	 *
491
+	 * 	@return		int		<=0 if KO, >0 if OK
492
+	 */
493
+	private function loadTables()
494
+	{
495
+		return $this->_load_tables('/subtotal/sql/');
496
+	}
497 497
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * 	\ingroup	titre
24 24
  * 	\brief		Description and activation file for module titre
25 25
  */
26
-include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
26
+include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php";
27 27
 
28 28
 /**
29 29
  * Description and activation class for module titre
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->version = '3.0.1';
67 67
         // Key used in llx_const table to save module status enabled/disabled
68 68
         // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
69
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
70 70
         // Where to store the module in setup page
71 71
         // (0=common,1=interface,2=others,3=very specific)
72 72
         $this->special = 2;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             // Set this to relative path of css if module has its own css file
97 97
             //'css' => '/titre/css/mycss.css.php',
98 98
             // Set here all hooks context managed by module
99
-            'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
99
+            'hooks' => array('invoicecard', 'propalcard', 'ordercard', 'odtgeneration', 'orderstoinvoice', 'admin', 'invoicereccard')
100 100
             // Set here all workflow context managed by module
101 101
             //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102 102
         );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         // List of modules id that must be enabled if this module is enabled
114 114
         $this->depends = array();
115 115
 
116
-		$this->conflictwith=array('modMilestone');
116
+		$this->conflictwith = array('modMilestone');
117 117
         // List of modules id to disable if this one is disabled
118 118
         $this->requiredby = array();
119 119
         // Minimum version of PHP required by module
@@ -178,20 +178,20 @@  discard block
 block discarded – undo
178 178
         // 'categories_x'		to add a tab in category view
179 179
         // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180 180
         // Dictionnaries
181
-        if (! isset($conf->subtotal->enabled)) {
182
-            $conf->subtotal=new stdClass();
181
+        if (!isset($conf->subtotal->enabled)) {
182
+            $conf->subtotal = new stdClass();
183 183
             $conf->subtotal->enabled = 0;
184 184
         }
185 185
         $this->dictionaries = array(
186 186
 			'langs'=>'subtotal@subtotal',
187
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
190
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
191
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
187
+            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor
188
+            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables
189
+            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields
190
+            'tabsqlsort'=>array('label ASC'), // Sort order
191
+            'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary)
192
+            'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record)
193
+            'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert)
194
+            'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid')
195 195
             'tabcond'=>array($conf->subtotal->enabled)	
196 196
 		);
197 197
         /* Example:
Please login to merge, or discard this patch.