Passed
Pull Request — master (#142)
by
unknown
03:01
created
class/subtotal.class.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 			 * @var $object Facture fournisseur
42 42
 			 */
43 43
 			else if($object->element=='invoice_supplier') {
44
-			    $object->special_code = TSubtotal::$module_number;
45
-                if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1;
46
-			    $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
44
+				$object->special_code = TSubtotal::$module_number;
45
+				if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1;
46
+				$res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
47 47
 			}
48 48
 			/**
49 49
 			 * @var $object Propal
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 			 * @var $object Commande fournisseur
63 63
 			 */
64 64
 			else if($object->element=='order_supplier') {
65
-			    $object->special_code = TSubtotal::$module_number;
66
-			    $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9);
65
+				$object->special_code = TSubtotal::$module_number;
66
+				$res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9);
67 67
 			}
68 68
 			/**
69 69
 			 * @var $object Facturerec
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 	{
324 324
 		if (empty($fk_commande)) return false;
325 325
 
326
-        $table = 'commandedet';
327
-        if ($supplier) $table = 'commande_fournisseurdet';
326
+		$table = 'commandedet';
327
+		if ($supplier) $table = 'commande_fournisseurdet';
328 328
 
329 329
 		$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$table.' WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1';
330 330
 		$resql = $db->query($sql);
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 	
377 377
 	public static function isSubtotal(&$line, $level=-1)
378 378
 	{
379
-	    $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90;
380
-	    if($res && $level > -1) {
381
-	        return self::getNiveau($line) == $level;
382
-	    } else return $res;
379
+		$res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90;
380
+		if($res && $level > -1) {
381
+			return self::getNiveau($line) == $level;
382
+		} else return $res;
383 383
 	}
384 384
 	
385 385
 	public static function isFreeText(&$line)
@@ -416,29 +416,29 @@  discard block
 block discarded – undo
416 416
 		$createRight = $user->rights->{$object->element}->creer;
417 417
 		if($object->element == 'facturerec' )
418 418
 		{
419
-		    $object->statut = 0; // hack for facture rec
420
-		    $createRight = $user->rights->facture->creer;
419
+			$object->statut = 0; // hack for facture rec
420
+			$createRight = $user->rights->facture->creer;
421 421
 		}
422 422
 		elseif($object->element == 'order_supplier' )
423 423
 		{
424
-		    $createRight = $user->rights->fournisseur->commande->creer;
424
+			$createRight = $user->rights->fournisseur->commande->creer;
425 425
 		}
426 426
 		elseif($object->element == 'invoice_supplier' )
427 427
 		{
428
-		    $createRight = $user->rights->fournisseur->facture->creer;
428
+			$createRight = $user->rights->fournisseur->facture->creer;
429 429
 		}
430 430
 		
431 431
 		if ($object->statut == 0  && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE)))
432 432
 		{
433 433
 			dol_include_once('/subtotal/lib/subtotal.lib.php');
434 434
 
435
-            if(!empty($object->lines)) {
436
-                foreach($object->lines as $line) {
437
-                    if($line->id == $lineid) $duplicateLine = $line;
438
-                }
439
-            }
440
-            if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine);
441
-            else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine);
435
+			if(!empty($object->lines)) {
436
+				foreach($object->lines as $line) {
437
+					if($line->id == $lineid) $duplicateLine = $line;
438
+				}
439
+			}
440
+			if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine);
441
+			else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine);
442 442
 
443 443
 			if (!empty($TLine))
444 444
 			{
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 							break;
457 457
 							
458 458
 						case 'supplier_proposal':
459
-						    $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $object->element, $line->id);
460
-						    break;
459
+							$res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $object->element, $line->id);
460
+							break;
461 461
 							
462 462
 						case 'commande':
463 463
 							//$desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 							break;
466 466
 							
467 467
 						case 'order_supplier':
468
-						    $object->line = $line;
469
-						    $object->line->fk_commande = $object->id;
470
-						    $object->line->rang = $object->line_max() +1;
471
-						    $res = $object->line->insert(1);
468
+							$object->line = $line;
469
+							$object->line->fk_commande = $object->id;
470
+							$object->line->rang = $object->line_max() +1;
471
+							$res = $object->line->insert(1);
472 472
 							break;
473 473
 							
474 474
 						case 'facture':
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 					$object->db->commit();
522 522
 					foreach ($TLineAdded as &$line)
523 523
 					{
524
-					    // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne
525
-					    _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']);
524
+						// ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne
525
+						_updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']);
526 526
 					}
527 527
 					return count($TLineAdded);
528 528
 				}
@@ -596,33 +596,33 @@  discard block
 block discarded – undo
596 596
 		
597 597
 		switch ($object->element) 
598 598
 		{
599
-		    case 'propal':
600
-		        $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger);
601
-		        break;
599
+			case 'propal':
600
+				$res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger);
601
+				break;
602 602
 		        
603
-		    case 'supplier_proposal':
604
-		        $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit);
605
-		        break;
603
+			case 'supplier_proposal':
604
+				$res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit);
605
+				break;
606 606
 		        
607 607
 			case 'commande':
608 608
 				$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $fk_unit, 0, $notrigger);
609 609
 				break;
610 610
 				
611 611
 			case 'order_supplier':
612
-			    $object->special_code = SELF::$module_number;
613
-			    if (empty($desc)) $desc = $label;
614
-			    $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit);
615
-			    break;
612
+				$object->special_code = SELF::$module_number;
613
+				if (empty($desc)) $desc = $label;
614
+				$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit);
615
+				break;
616 616
 			
617 617
 			case 'facture':
618 618
 				$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $situation_percent, $fk_unit, 0, $notrigger);
619 619
 				break;
620 620
 				
621 621
 			case 'invoice_supplier':
622
-			    $object->special_code = SELF::$module_number;
623
-			    if (empty($desc)) $desc = $label;
624
-			    $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit);
625
-			    break;
622
+				$object->special_code = SELF::$module_number;
623
+				if (empty($desc)) $desc = $label;
624
+				$res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit);
625
+				break;
626 626
 				
627 627
 			case 'facturerec':
628 628
 				// Add extrafields and get rang
@@ -1013,8 +1013,8 @@  discard block
 block discarded – undo
1013 1013
 		{
1014 1014
 			if (is_readable($logo))
1015 1015
 			{
1016
-			    $height=pdf_getHeightForLogo($logo);
1017
-			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1016
+				$height=pdf_getHeightForLogo($logo);
1017
+				$pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1018 1018
 			}
1019 1019
 			else
1020 1020
 			{
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
 	 * @param	int		$hidebottom		Hide bottom
1206 1206
 	 * @return	void
1207 1207
 	 */
1208
-    private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1209
-    {
1210
-	    if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1211
-	    $pdf->line($x+$l, $y, $x+$l, $y+$h);
1212
-	    if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1213
-	    $pdf->line($x, $y+$h, $x, $y);
1214
-    }
1208
+	private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1209
+	{
1210
+		if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1211
+		$pdf->line($x+$l, $y, $x+$l, $y+$h);
1212
+		if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1213
+		$pdf->line($x, $y+$h, $x, $y);
1214
+	}
1215 1215
 	
1216 1216
 	
1217 1217
 	public static function concat(&$outputlangs, $files, $fileoutput='')
@@ -1221,14 +1221,14 @@  discard block
 block discarded – undo
1221 1221
 		if (empty($fileoutput)) $fileoutput = $file[0];
1222 1222
 		
1223 1223
 		$pdf=pdf_getInstance();
1224
-        if (class_exists('TCPDF'))
1225
-        {
1226
-            $pdf->setPrintHeader(false);
1227
-            $pdf->setPrintFooter(false);
1228
-        }
1229
-        $pdf->SetFont(pdf_getPDFFont($outputlangs));
1224
+		if (class_exists('TCPDF'))
1225
+		{
1226
+			$pdf->setPrintHeader(false);
1227
+			$pdf->setPrintFooter(false);
1228
+		}
1229
+		$pdf->SetFont(pdf_getPDFFont($outputlangs));
1230 1230
 
1231
-        if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1231
+		if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1232 1232
 
1233 1233
 		
1234 1234
 		foreach($files as $file)
Please login to merge, or discard this patch.