Completed
Branch develop (cb0ab5)
by
unknown
22:12
created
htdocs/core/modules/facture/doc/pdf_octopus.modules.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * Dolibarr version of the loaded document
79 79
 	 * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental'
80 80
 	 */
81
-	public $version = 'disabled';	// Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
81
+	public $version = 'disabled'; // Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
82 82
 
83 83
 	/**
84 84
 	 * @var int height for info total
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		}
248 248
 
249 249
 		if ($mysoc === null) {
250
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
250
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
251 251
 			return;
252 252
 		}
253 253
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies", "compta"));
298 298
 		}
299 299
 
300
-		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE &&  !empty($object->situation_cycle_ref)))) {
300
+		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE && !empty($object->situation_cycle_ref)))) {
301 301
 			setEventMessage($langs->trans('WarningsObjectIsNotASituation'), 'warnings');
302 302
 			return 1;
303 303
 		}
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
 				$pdf->SetAutoPageBreak(1, 0);
417 417
 
418 418
 				// compute height for situation invoices
419
-				$this->heightforinfotot = 45;	// Height reserved to output the info and total part and payment part
419
+				$this->heightforinfotot = 45; // Height reserved to output the info and total part and payment part
420 420
 				if (!getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS') && $nbpayments > 0) {
421 421
 					$this->heightforinfotot += 4 * ($nbpayments + 3);
422 422
 				}
423 423
 				if ($nbprevsituation > 0) {
424 424
 					$this->heightforinfotot += 4 * ($nbprevsituation + 3);
425 425
 				}
426
-				$this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5));	// Height reserved to output the free text on last page
427
-				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);	// Height reserved to output the footer (value include bottom margin)
426
+				$this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page
427
+				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
428 428
 
429 429
 				if (class_exists('TCPDF')) {
430 430
 					$pdf->setPrintHeader(false);
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 					if (!empty($conf->mycompany->multidir_output[$object->entity])) {
439 439
 						$logodir = $conf->mycompany->multidir_output[$object->entity];
440 440
 					}
441
-					$pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
441
+					$pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
442 442
 					$this->tplidx = $pdf->importPage(1);
443 443
 				}
444 444
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 				// $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher
531 531
 
532 532
 				// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
533
-				$this->tab_top = 90 + $top_shift + $shipp_shift;		// top_shift is an addition for linked objects or addons (0 in most cases)
533
+				$this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
534 534
 				$this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
535 535
 
536 536
 				// You can add more thing under header here, if you increase $extra_under_address_shift too.
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 					if (!isset($this->tva[$vatrate])) {
1041 1041
 						$this->tva[$vatrate] = 0;
1042 1042
 					}
1043
-					$this->tva[$vatrate] += $tvaligne;	// ->tva is abandoned, we use now ->tva_array that is more complete
1043
+					$this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete
1044 1044
 					$vatcode = $object->lines[$i]->vat_src_code;
1045 1045
 					if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
1046 1046
 						$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 				// Pagefoot
1130 1130
 				$this->_pagefoot($pdf, $object, $outputlangs);
1131 1131
 				if (method_exists($pdf, 'AliasNbPages')) {
1132
-					$pdf->AliasNbPages();  // @phan-suppress-current-line PhanUndeclaredMethod
1132
+					$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
1133 1133
 				}
1134 1134
 
1135 1135
 				$this->resumeLastPage($pdf, $object, 0, $tab_top, $outputlangs, $outputlangsbis);
@@ -1341,8 +1341,8 @@  discard block
 block discarded – undo
1341 1341
 			$posy = $pdf->GetY() + 4;
1342 1342
 		}
1343 1343
 
1344
-		$posxval = 52;	// Position of values of properties shown on left side
1345
-		$posxend = 110;	// End of x for text on left side
1344
+		$posxval = 52; // Position of values of properties shown on left side
1345
+		$posxend = 110; // End of x for text on left side
1346 1346
 		if ($this->page_largeur < 210) { // To work with US executive format
1347 1347
 			$posxend -= 10;
1348 1348
 		}
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 
1373 1373
 			$pdf->SetFont('', '', $default_font_size - 2);
1374 1374
 			$pdf->SetXY($posxval, $posy);
1375
-			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
1375
+			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
1376 1376
 			$pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L');
1377 1377
 
1378 1378
 			$posy = $pdf->GetY() + 3; // for 2 lines
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
 						include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php';
1540 1540
 						$invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type);
1541 1541
 
1542
-						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0);
1542
+						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": ".$outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0);
1543 1543
 					}
1544 1544
 				}
1545 1545
 			}
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
 					if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
1715 1715
 						$vatrate .= '*';
1716 1716
 					}
1717
-					if (! isset($tvas[$vatrate])) {
1717
+					if (!isset($tvas[$vatrate])) {
1718 1718
 						$tvas[$vatrate] = 0;
1719 1719
 					}
1720 1720
 					$tvas[$vatrate] += $tvaligne;
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
 		if (empty($hidetop)) {
1983 1983
 			// Show category of operations
1984 1984
 			if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) {
1985
-				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
1985
+				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
1986 1986
 				$pdf->SetXY($this->marge_gauche, $tab_top - 4);
1987 1987
 				$pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations);
1988 1988
 			}
@@ -2002,7 +2002,7 @@  discard block
 block discarded – undo
2002 2002
 		$pdf->SetFont('', '', $default_font_size - 1);
2003 2003
 
2004 2004
 		// Output Rect
2005
-		$this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D');	// Rect prend une longueur en 3eme param et 4eme param
2005
+		$this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param
2006 2006
 
2007 2007
 		// situation invoice
2008 2008
 		$pdf->SetFont('', '', $default_font_size - 2);
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 		$pdf->SetFont('', '', $default_font_size - 1);
2043 2043
 
2044 2044
 		if (empty($hidetop)) {
2045
-			$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);	// line prend une position y en 2eme param et 4eme param
2045
+			$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param
2046 2046
 		}
2047 2047
 	}
2048 2048
 
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
 			'overtitle' => array(
2620 2620
 				'textkey' => 'Chantier', // use lang key is useful in somme case with module
2621 2621
 				'align' => 'C',
2622
-				'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2622
+				'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2623 2623
 				'width' => 18
2624 2624
 			),
2625 2625
 		);
@@ -2644,13 +2644,13 @@  discard block
 block discarded – undo
2644 2644
 			),
2645 2645
 			'border-left' => true, // add left line separator
2646 2646
 			'overtitle' => array(
2647
-				'textkey' => 'S'.$derniere_situation->situation_counter . ' - ' . dol_print_date($derniere_situation->date, "%d/%m/%Y"),
2647
+				'textkey' => 'S'.$derniere_situation->situation_counter.' - '.dol_print_date($derniere_situation->date, "%d/%m/%Y"),
2648 2648
 				'align' => 'C',
2649
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2649
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2650 2650
 				'width' => 10 + 15 //current width + amount cell width
2651 2651
 			),
2652 2652
 		);
2653
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2653
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2654 2654
 			$this->cols['prev_progress']['status'] = true;
2655 2655
 		}
2656 2656
 
@@ -2665,7 +2665,7 @@  discard block
 block discarded – undo
2665 2665
 			),
2666 2666
 			'border-left' => true, // add left line separator
2667 2667
 		);
2668
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2668
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2669 2669
 			$this->cols['prev_progress_amount']['status'] = true;
2670 2670
 		}
2671 2671
 
@@ -2680,9 +2680,9 @@  discard block
 block discarded – undo
2680 2680
 			),
2681 2681
 			'border-left' => true, // add left line separator
2682 2682
 			'overtitle' => array(
2683
-				'textkey' => 'S'.$object->situation_counter . ' - ' . dol_print_date($object->date, "%d/%m/%Y"),
2683
+				'textkey' => 'S'.$object->situation_counter.' - '.dol_print_date($object->date, "%d/%m/%Y"),
2684 2684
 				'align' => 'C',
2685
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2685
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2686 2686
 				'width' => 10 + 15
2687 2687
 			),
2688 2688
 		);
@@ -2807,7 +2807,7 @@  discard block
 block discarded – undo
2807 2807
 
2808 2808
 		// Output Rect
2809 2809
 		// KEEPTHIS => Affiche les bords extérieurs
2810
-		$this->printRoundedRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D');	// Rect prend une longueur en 3eme param et 4eme param
2810
+		$this->printRoundedRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param
2811 2811
 
2812 2812
 		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top, $this->posx_cumul_anterieur - 1, $tab_top + $tab_height);
2813 2813
 		if (empty($hidetop)) {
@@ -2864,7 +2864,7 @@  discard block
 block discarded – undo
2864 2864
 			$pdf->SetXY($this->marge_gauche + 10, $tab_top + 24 + $i);
2865 2865
 			$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalHT").' '.$TVatInfo['label'], '', 'L');
2866 2866
 
2867
-			if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2867
+			if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2868 2868
 				$pdf->SetXY($this->marge_gauche + 10, $tab_top + 28 + $i);
2869 2869
 				$pdf->MultiCell(80, 2, $outputlangs->transnoentities("VAT").' '.$TVatInfo['label'], '', 'L');
2870 2870
 			} else {
@@ -2928,7 +2928,7 @@  discard block
 block discarded – undo
2928 2928
 				$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['HT'], 0, '', 1, -1, 2), '', 'R');
2929 2929
 
2930 2930
 				// Total TVA
2931
-				if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2931
+				if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2932 2932
 					$pdf->SetXY($x, $tab_top + 28 + $i);
2933 2933
 					$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['TVA'], 0, '', 1, -1, 2), '', 'R');
2934 2934
 				} else {
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
 
3009 3009
 		$TDataSituation = array();
3010 3010
 
3011
-		if (! empty($facDerniereSituation)) {
3011
+		if (!empty($facDerniereSituation)) {
3012 3012
 			$TDataSituation['derniere_situation'] = $facDerniereSituation;
3013 3013
 			$TDataSituation['date_derniere_situation'] = $facDerniereSituation->date;
3014 3014
 		}
@@ -3017,9 +3017,9 @@  discard block
 block discarded – undo
3017 3017
 		$retenue_garantie_anterieure = 0;
3018 3018
 		// Init tous les champs à 0
3019 3019
 		$TDataSituation['cumul_anterieur'] = array(
3020
-			'HT' => 0,	//montant HT normal
3021
-			'TVA' => 0,   //montant de la TVA sur le HTnet
3022
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
3020
+			'HT' => 0, //montant HT normal
3021
+			'TVA' => 0, //montant de la TVA sur le HTnet
3022
+			'TTC' => 0, //montant TTC (HTnet + TVA)
3023 3023
 			'retenue_garantie' => 0,
3024 3024
 			'travaux_sup' => 0,
3025 3025
 			'HTnet' => 0, //montant HT
@@ -3049,7 +3049,7 @@  discard block
 block discarded – undo
3049 3049
 					$isFirstSituation = false;
3050 3050
 					if (!empty($l->fk_prev_id)) {
3051 3051
 						$prevSituationPercent = $l->get_prev_progress($previousInvoice->id, true);
3052
-					} elseif (! array_key_exists($i + 1, $TPreviousInvoices)) {
3052
+					} elseif (!array_key_exists($i + 1, $TPreviousInvoices)) {
3053 3053
 						$isFirstSituation = true;
3054 3054
 					}
3055 3055
 
@@ -3059,7 +3059,7 @@  discard block
 block discarded – undo
3059 3059
 
3060 3060
 					//1ere ligne
3061 3061
 					$amounttva = $calc_ht * ($ltvatx / 100);
3062
-					if (! isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3062
+					if (!isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3063 3063
 						$TDataSituation['cumul_anterieur'][$ltvatx]['HT'] = $calc_ht;
3064 3064
 						$TDataSituation['cumul_anterieur'][$ltvatx]['TVA'] = $amounttva;
3065 3065
 					} else {
@@ -3071,14 +3071,14 @@  discard block
 block discarded – undo
3071 3071
 					//le grand total de TVA
3072 3072
 					// $TDataSituation['cumul_anterieur']['TVA'] += $amounttva;
3073 3073
 
3074
-					if (empty($l->fk_prev_id) && ! $isFirstSituation) {
3074
+					if (empty($l->fk_prev_id) && !$isFirstSituation) {
3075 3075
 						// TODO: à clarifier, mais pour moi, un facture de situation précédente qui a des progressions à 0% c'est pas logique
3076 3076
 						$TDataSituation['cumul_anterieur']['travaux_sup'] += $calc_ht;
3077 3077
 					}
3078 3078
 				}
3079 3079
 			}
3080 3080
 
3081
-			if (! empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3081
+			if (!empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3082 3082
 				$retenue_garantie_anterieure += $previousInvoice->getRetainedWarrantyAmount();
3083 3083
 			}
3084 3084
 
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
 		// print json_encode($facDerniereSituation->lines);exit;
3093 3093
 		$TDataSituation['current'] = $this->btpGetInvoiceAmounts($object->id);
3094 3094
 
3095
-		if (! empty($facDerniereSituation->lines)) {
3095
+		if (!empty($facDerniereSituation->lines)) {
3096 3096
 			$TFacLinesKey = array_keys($facDerniereSituation->lines);
3097 3097
 			$TObjectLinesKey = array_keys($object->lines);
3098 3098
 			$TDiffKey = array_diff($TObjectLinesKey, $TFacLinesKey);
@@ -3286,7 +3286,7 @@  discard block
 block discarded – undo
3286 3286
 	 */
3287 3287
 	public function btpGetInvoiceAmounts($id, $forceReadFromDB = false)
3288 3288
 	{
3289
-		global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
3289
+		global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes;
3290 3290
 
3291 3291
 		$object = new Facture($db);
3292 3292
 		$object->fetch($id);
@@ -3304,16 +3304,16 @@  discard block
 block discarded – undo
3304 3304
 		$facDerniereSituation = $TPreviousInvoices[0];
3305 3305
 
3306 3306
 		$ret = array(
3307
-			'HT' => 0,	//montant HT normal
3307
+			'HT' => 0, //montant HT normal
3308 3308
 			'HTnet' => 0, //montant HT
3309
-			'TVA' => 0,   //montant de la TVA sur le HTnet
3310
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
3309
+			'TVA' => 0, //montant de la TVA sur le HTnet
3310
+			'TTC' => 0, //montant TTC (HTnet + TVA)
3311 3311
 			'retenue_garantie' => 0,
3312 3312
 			'travaux_sup' => 0,
3313 3313
 			'total_a_payer' => 0 //montant "a payer" sur la facture
3314 3314
 		);
3315 3315
 
3316
-		if (! empty($facDerniereSituation)) {
3316
+		if (!empty($facDerniereSituation)) {
3317 3317
 			$ret['derniere_situation'] = $facDerniereSituation;
3318 3318
 			$ret['date_derniere_situation'] = $facDerniereSituation->date;
3319 3319
 		}
@@ -3445,7 +3445,7 @@  discard block
 block discarded – undo
3445 3445
 			$label = $outputlangs->transnoentities("SituationInvoiceTotalProposal");
3446 3446
 			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy + 1);
3447 3447
 
3448
-			$amount = price($sign * ($total_ht + (! empty($propal->remise) ? $propal->remise : 0)));
3448
+			$amount = price($sign * ($total_ht + (!empty($propal->remise) ? $propal->remise : 0)));
3449 3449
 			$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1);
3450 3450
 
3451 3451
 			$pdf->SetFont('', '', $default_font_size - 1);
@@ -3488,7 +3488,7 @@  discard block
 block discarded – undo
3488 3488
 
3489 3489
 		$force_to_zero = false;
3490 3490
 
3491
-		$idinv = 0;//count($previousinvoices);
3491
+		$idinv = 0; //count($previousinvoices);
3492 3492
 		while ($idinv < count($previousinvoices)) {
3493 3493
 			$invoice = $previousinvoices[$idinv];
3494 3494
 
@@ -3510,7 +3510,7 @@  discard block
 block discarded – undo
3510 3510
 				$force_to_zero = true;
3511 3511
 			}
3512 3512
 
3513
-			$ref .= ' - '. $invoice->ref;
3513
+			$ref .= ' - '.$invoice->ref;
3514 3514
 			$ref .= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')';
3515 3515
 			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $ref, 0, 'L', 0);
3516 3516
 
@@ -3541,7 +3541,7 @@  discard block
 block discarded – undo
3541 3541
 				if (($invoice->lines[$i]->info_bits & 0x01) == 0x01) {
3542 3542
 					$vatrate .= '*';
3543 3543
 				}
3544
-				if (! isset($tvas[$vatrate])) {
3544
+				if (!isset($tvas[$vatrate])) {
3545 3545
 					$tvas[$vatrate] = 0;
3546 3546
 				}
3547 3547
 				$tvas[$vatrate] += $tvaligne;
@@ -3719,7 +3719,7 @@  discard block
 block discarded – undo
3719 3719
 						$pdf->SetXY($posx + $width4, $posy + $height * $index + $y);
3720 3720
 						$pdf->MultiCell($width4, $height - 1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0);
3721 3721
 						$pdf->SetXY($posx + $width4 * 2, $posy + $height * $index + $y);
3722
-						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $payment['type']);
3722
+						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$payment['type']);
3723 3723
 
3724 3724
 						$pdf->MultiCell($width4, $height - 1, $oper, 0, 'L', 0);
3725 3725
 						$pdf->SetXY($posx + $width4 * 3, $posy + $height * $index + $y);
@@ -3750,7 +3750,7 @@  discard block
 block discarded – undo
3750 3750
 					$this->_pagehead($pdf, $object, 0, $outputlangs);
3751 3751
 				}
3752 3752
 				$pdf->setPage($pageposafter + 1);
3753
-				$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3753
+				$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3754 3754
 
3755 3755
 				$posy = $this->tab_top_newpage + 1;
3756 3756
 			} else {
@@ -3782,7 +3782,7 @@  discard block
 block discarded – undo
3782 3782
 
3783 3783
 		$posy += 10;
3784 3784
 
3785
-		$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3785
+		$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3786 3786
 
3787 3787
 		$pdf->SetTextColor(0, 0, 60);
3788 3788
 		$pdf->SetFont('', '', $default_font_size - 1);
Please login to merge, or discard this patch.
htdocs/core/modules/propale/doc/pdf_cyan.modules.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$this->atleastonediscount = 0;
137 137
 
138 138
 		if ($mysoc === null) {
139
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
139
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
140 140
 			return;
141 141
 		}
142 142
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 					if (!empty($conf->mycompany->multidir_output[$object->entity])) {
312 312
 						$logodir = $conf->mycompany->multidir_output[$object->entity];
313 313
 					}
314
-					$pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
314
+					$pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
315 315
 					$tplidx = $pdf->importPage(1);
316 316
 				}
317 317
 
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 				// Pagefoot
881 881
 				$this->_pagefoot($pdf, $object, $outputlangs);
882 882
 				if (method_exists($pdf, 'AliasNbPages')) {
883
-					$pdf->AliasNbPages();  // @phan-suppress-current-line PhanUndeclaredMethod
883
+					$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
884 884
 				}
885 885
 
886 886
 				//If propal merge product PDF is active
@@ -1236,11 +1236,11 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 		// Total HT
1238 1238
 		$pdf->SetFillColor(255, 255, 255);
1239
-		$pdf->SetXY($col1x, $tab2_top+ $tab2_hl * $index);
1239
+		$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1240 1240
 		$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
1241 1241
 
1242 1242
 		$total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
1243
-		$pdf->SetXY($col2x, $tab2_top+ $tab2_hl * $index);
1243
+		$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1244 1244
 		$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
1245 1245
 
1246 1246
 		// Show VAT by rates and total
Please login to merge, or discard this patch.
htdocs/mrp/mo_production.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0);
137 137
 		$result = $object->cancel($user, 0, $also_cancel_consumed_and_produced_lines);
138 138
 		if ($result > 0) {
139
-			header("Location: " . DOL_URL_ROOT.'/mrp/mo_card.php?id=' . $object->id);
139
+			header("Location: ".DOL_URL_ROOT.'/mrp/mo_card.php?id='.$object->id);
140 140
 			exit;
141 141
 		} else {
142 142
 			$action = '';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0);
147 147
 		$result = $object->delete($user, 0, $also_cancel_consumed_and_produced_lines);
148 148
 		if ($result > 0) {
149
-			header("Location: " . $backurlforlist);
149
+			header("Location: ".$backurlforlist);
150 150
 			exit;
151 151
 		} else {
152 152
 			$action = '';
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 				'value' => !getDolGlobalString('MO_ALSO_CANCEL_CONSUMED_AND_PRODUCED_LINES_BY_DEFAULT') ? 0 : 1
607 607
 			),
608 608
 		);
609
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CancelMo'), $langs->trans('ConfirmCancelMo'), 'confirm_cancel', $formquestion, 0, 1);
609
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CancelMo'), $langs->trans('ConfirmCancelMo'), 'confirm_cancel', $formquestion, 0, 1);
610 610
 	}
611 611
 
612 612
 	// Call Hook formConfirm
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
 				print '<td></td>';
927 927
 			}
928 928
 
929
-			$colspan="3";
929
+			$colspan = "3";
930 930
 			if (isModEnabled('stock')) {
931
-				$colspan++;;
931
+				$colspan++; ;
932 932
 			}
933 933
 			if (isModEnabled('productbatch')) {
934 934
 				$colspan++;
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 
965 965
 		// Lines to consume
966 966
 
967
-		$bomcostupdated = 0;	// We will recalculate the unitary cost to produce a product using the real "products to consume into MO"
967
+		$bomcostupdated = 0; // We will recalculate the unitary cost to produce a product using the real "products to consume into MO"
968 968
 
969 969
 		if (!empty($object->lines)) {
970 970
 			$nblinetoconsume = 0;
@@ -1011,15 +1011,15 @@  discard block
 block discarded – undo
1011 1011
 							}
1012 1012
 
1013 1013
 							if ($qtyhourservice && $qtyhourforline) {
1014
-								$linecost = price2num(($qtyhourforline / $qtyhourservice * $costprice) / $object->qty, 'MT');	// price for line for all quantities
1015
-								$bomcostupdated += price2num(($qtyhourforline / $qtyhourservice * $costprice) / $object->qty, 'MU');	// same but with full accuracy
1014
+								$linecost = price2num(($qtyhourforline / $qtyhourservice * $costprice) / $object->qty, 'MT'); // price for line for all quantities
1015
+								$bomcostupdated += price2num(($qtyhourforline / $qtyhourservice * $costprice) / $object->qty, 'MU'); // same but with full accuracy
1016 1016
 							} else {
1017
-								$linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT');	// price for line for all quantities
1018
-								$bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU');	// same but with full accuracy
1017
+								$linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); // price for line for all quantities
1018
+								$bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU'); // same but with full accuracy
1019 1019
 							}
1020 1020
 						} else {
1021
-							$linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT');	// price for line for all quantities
1022
-							$bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU');	// same but with full accuracy
1021
+							$linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); // price for line for all quantities
1022
+							$bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU'); // same but with full accuracy
1023 1023
 						}
1024 1024
 					}
1025 1025
 
@@ -1040,23 +1040,23 @@  discard block
 block discarded – undo
1040 1040
 								$alreadyconsumed += $line2['qty'];
1041 1041
 							}
1042 1042
 						}
1043
-						$suffix = '_' . $line->id;
1044
-						print '<!-- Line to dispatch ' . $suffix . ' (line edited) -->' . "\n";
1043
+						$suffix = '_'.$line->id;
1044
+						print '<!-- Line to dispatch '.$suffix.' (line edited) -->'."\n";
1045 1045
 						// hidden fields for js function
1046
-						print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $line->qty . '">';
1046
+						print '<input id="qty_ordered'.$suffix.'" type="hidden" value="'.$line->qty.'">';
1047 1047
 						// Duration - Time spent
1048
-						print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . $alreadyconsumed . '">';
1048
+						print '<input id="qty_dispatched'.$suffix.'" type="hidden" value="'.$alreadyconsumed.'">';
1049 1049
 						print '<tr>';
1050
-						print '<input name="lineid" type="hidden" value="' . $line->id . '">';
1050
+						print '<input name="lineid" type="hidden" value="'.$line->id.'">';
1051 1051
 
1052 1052
 						// Product
1053
-						print '<td>' . $tmpproduct->getNomUrl(1);
1054
-						print '<br><div class="opacitymedium small tdoverflowmax150" title="' . dol_escape_htmltag($tmpproduct->label) . '">' . $tmpproduct->label . '</span>';
1053
+						print '<td>'.$tmpproduct->getNomUrl(1);
1054
+						print '<br><div class="opacitymedium small tdoverflowmax150" title="'.dol_escape_htmltag($tmpproduct->label).'">'.$tmpproduct->label.'</span>';
1055 1055
 						print '</td>';
1056 1056
 
1057 1057
 						// Qty
1058 1058
 						print '<td class="right nowraponall">';
1059
-						print '<input class="width40 right" name="qty_lineProduce" value="'. $line->qty.'">';
1059
+						print '<input class="width40 right" name="qty_lineProduce" value="'.$line->qty.'">';
1060 1060
 						print '</td>';
1061 1061
 
1062 1062
 						// Unit
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
 						// Qty consumed
1076 1076
 						print '<td class="right">';
1077
-						print ' ' . price2num($alreadyconsumed, 'MS');
1077
+						print ' '.price2num($alreadyconsumed, 'MS');
1078 1078
 						print '</td>';
1079 1079
 
1080 1080
 						// Entrepot
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 								if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) {
1089 1089
 									print img_warning($langs->trans('StockTooLow')).' ';
1090 1090
 								}
1091
-								print '<span class="left">'. $tmpproduct->stock_reel  .' </span>';
1091
+								print '<span class="left">'.$tmpproduct->stock_reel.' </span>';
1092 1092
 							}
1093 1093
 							print '</td>';
1094 1094
 						}
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
 						}
1100 1100
 						// Split + SplitAll + Edit line + Delete
1101 1101
 						print '<td colspan="'.(3 + ($object->status == Mo::STATUS_DRAFT ? 1 : 0) + ($permissiontodelete ? 1 : 0)).'">';
1102
-						print '<input type="submit" class="button buttongen button-add small nominwidth" name="save" value="' . $langs->trans("Save") . '">';
1103
-						print '<input type="submit" class="button buttongen button-cancel small nominwidth" name="cancel" value="' . $langs->trans("Cancel") . '">';
1102
+						print '<input type="submit" class="button buttongen button-add small nominwidth" name="save" value="'.$langs->trans("Save").'">';
1103
+						print '<input type="submit" class="button buttongen button-cancel small nominwidth" name="cancel" value="'.$langs->trans("Cancel").'">';
1104 1104
 						print '</td>';
1105 1105
 
1106 1106
 						print '</tr>';
@@ -1117,29 +1117,29 @@  discard block
 block discarded – undo
1117 1117
 							}
1118 1118
 						}
1119 1119
 					} else {
1120
-						$suffix = '_' . $line->id;
1121
-						print '<!-- Line to dispatch ' . $suffix . ' -->' . "\n";
1120
+						$suffix = '_'.$line->id;
1121
+						print '<!-- Line to dispatch '.$suffix.' -->'."\n";
1122 1122
 						// hidden fields for js function
1123
-						print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $line->qty . '">';
1124
-						print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . $alreadyconsumed . '">';
1123
+						print '<input id="qty_ordered'.$suffix.'" type="hidden" value="'.$line->qty.'">';
1124
+						print '<input id="qty_dispatched'.$suffix.'" type="hidden" value="'.$alreadyconsumed.'">';
1125 1125
 
1126
-						print '<tr data-line-id="' . $line->id . '">';
1126
+						print '<tr data-line-id="'.$line->id.'">';
1127 1127
 
1128 1128
 						// Product
1129
-						print '<td>' . $tmpproduct->getNomUrl(1);
1130
-						print '<br><div class="opacitymedium small tdoverflowmax150" title="' . dol_escape_htmltag($tmpproduct->label) . '">' . $tmpproduct->label . '</div>';
1129
+						print '<td>'.$tmpproduct->getNomUrl(1);
1130
+						print '<br><div class="opacitymedium small tdoverflowmax150" title="'.dol_escape_htmltag($tmpproduct->label).'">'.$tmpproduct->label.'</div>';
1131 1131
 						print '</td>';
1132 1132
 
1133 1133
 						// Qty
1134 1134
 						print '<td class="right nowraponall">';
1135 1135
 						$help = '';
1136 1136
 						if ($line->qty_frozen) {
1137
-							$help = ($help ? '<br>' : '') . '<strong>' . $langs->trans("QuantityFrozen") . '</strong>: ' . yn(1) . ' (' . $langs->trans("QuantityConsumedInvariable") . ')';
1138
-							print $form->textwithpicto('', $help, -1, 'lock') . ' ';
1137
+							$help = ($help ? '<br>' : '').'<strong>'.$langs->trans("QuantityFrozen").'</strong>: '.yn(1).' ('.$langs->trans("QuantityConsumedInvariable").')';
1138
+							print $form->textwithpicto('', $help, -1, 'lock').' ';
1139 1139
 						}
1140 1140
 						if ($line->disable_stock_change) {
1141
-							$help = ($help ? '<br>' : '') . '<strong>' . $langs->trans("DisableStockChange") . '</strong>: ' . yn(1) . ' (' . (($tmpproduct->type == Product::TYPE_SERVICE && !getDolGlobalString('STOCK_SUPPORTS_SERVICES')) ? $langs->trans("NoStockChangeOnServices") : $langs->trans("DisableStockChangeHelp")) . ')';
1142
-							print $form->textwithpicto('', $help, -1, 'help') . ' ';
1141
+							$help = ($help ? '<br>' : '').'<strong>'.$langs->trans("DisableStockChange").'</strong>: '.yn(1).' ('.(($tmpproduct->type == Product::TYPE_SERVICE && !getDolGlobalString('STOCK_SUPPORTS_SERVICES')) ? $langs->trans("NoStockChangeOnServices") : $langs->trans("DisableStockChangeHelp")).')';
1142
+							print $form->textwithpicto('', $help, -1, 'help').' ';
1143 1143
 						}
1144 1144
 						print price2num($line->qty, 'MS');
1145 1145
 						print '</td>';
@@ -1164,9 +1164,9 @@  discard block
 block discarded – undo
1164 1164
 						if ($alreadyconsumed) {
1165 1165
 							print '<script>';
1166 1166
 							print 'jQuery(document).ready(function() {
1167
-								jQuery("#expandtoproduce' . $line->id . '").click(function() {
1168
-									console.log("Expand mrp_production line ' . $line->id . '");
1169
-									jQuery(".expanddetail' . $line->id . '").toggle();';
1167
+								jQuery("#expandtoproduce' . $line->id.'").click(function() {
1168
+									console.log("Expand mrp_production line ' . $line->id.'");
1169
+									jQuery(".expanddetail' . $line->id.'").toggle();';
1170 1170
 							if ($nblinetoconsume == $nblinetoconsumecursor) {    // If it is the last line
1171 1171
 								print 'if (jQuery("#tablelines").hasClass("nobottom")) { jQuery("#tablelines").removeClass("nobottom"); } else { jQuery("#tablelines").addClass("nobottom"); }';
1172 1172
 							}
@@ -1175,9 +1175,9 @@  discard block
 block discarded – undo
1175 1175
 							});';
1176 1176
 							print '</script>';
1177 1177
 							if (empty($conf->use_javascript_ajax)) {
1178
-								print '<a href="' . $_SERVER["PHP_SELF"] . '?collapse=' . $collapse . ',' . $line->id . '">';
1178
+								print '<a href="'.$_SERVER["PHP_SELF"].'?collapse='.$collapse.','.$line->id.'">';
1179 1179
 							}
1180
-							print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce' . $line->id . '"');
1180
+							print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"');
1181 1181
 							if (empty($conf->use_javascript_ajax)) {
1182 1182
 								print '</a>';
1183 1183
 							}
@@ -1186,13 +1186,13 @@  discard block
 block discarded – undo
1186 1186
 								print '<script>jQuery("#tablelines").removeClass("nobottom");</script>';
1187 1187
 							}
1188 1188
 						}
1189
-						print ' ' . price2num($alreadyconsumed, 'MS');
1189
+						print ' '.price2num($alreadyconsumed, 'MS');
1190 1190
 						print '</td>';
1191 1191
 
1192 1192
 						// Warehouse and/or workstation
1193 1193
 						print '<td>';
1194 1194
 						if (getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') && $tmpwarehouse->id > 0) {
1195
-							print img_picto('', $tmpwarehouse->picto) . " " . $tmpwarehouse->label;
1195
+							print img_picto('', $tmpwarehouse->picto)." ".$tmpwarehouse->label;
1196 1196
 						}
1197 1197
 						if (isModEnabled('workstation') && $line->fk_default_workstation > 0) {
1198 1198
 							$tmpworkstation = new Workstation($db);
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 							print '<td class="nowraponall right">';
1207 1207
 							if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES') && $tmpproduct->type != Product::TYPE_SERVICE) {
1208 1208
 								if (!$line->disable_stock_change && $tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) {
1209
-									print img_warning($langs->trans('StockTooLow')) . ' ';
1209
+									print img_warning($langs->trans('StockTooLow')).' ';
1210 1210
 								}
1211 1211
 								if (!getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') || empty($tmpwarehouse->id)) {
1212 1212
 									print price2num($tmpproduct->stock_reel, 'MS'); // Available
@@ -1237,9 +1237,9 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
 						// Action Edit line
1239 1239
 						if ($object->status == Mo::STATUS_DRAFT) {
1240
-							$href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=editline&token=' . newToken() . '&lineid=' . ((int) $line->id);
1240
+							$href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=editline&token='.newToken().'&lineid='.((int) $line->id);
1241 1241
 							print '<td class="center">';
1242
-							print '<a class="reposition editfielda" href="' . $href . '">';
1242
+							print '<a class="reposition editfielda" href="'.$href.'">';
1243 1243
 							print img_picto($langs->trans('TooltipEditAndRevertStockMovement'), 'edit');
1244 1244
 							print '</a>';
1245 1245
 							print '</td>';
@@ -1247,9 +1247,9 @@  discard block
 block discarded – undo
1247 1247
 
1248 1248
 						// Action delete line
1249 1249
 						if ($permissiontodelete) {
1250
-							$href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=deleteline&token=' . newToken() . '&lineid=' . ((int) $line->id);
1250
+							$href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deleteline&token='.newToken().'&lineid='.((int) $line->id);
1251 1251
 							print '<td class="center">';
1252
-							print '<a class="reposition" href="' . $href . '">';
1252
+							print '<a class="reposition" href="'.$href.'">';
1253 1253
 							print img_picto($langs->trans('TooltipDeleteAndRevertStockMovement'), 'delete');
1254 1254
 							print '</a>';
1255 1255
 							print '</td>';
@@ -1328,9 +1328,9 @@  discard block
 block discarded – undo
1328 1328
 
1329 1329
 						// Action Edit line
1330 1330
 						if ($object->status == Mo::STATUS_DRAFT) {
1331
-							$href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=editline&token=' . newToken() . '&lineid=' . ((int) $line2['rowid']);
1331
+							$href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=editline&token='.newToken().'&lineid='.((int) $line2['rowid']);
1332 1332
 							print '<td class="center">';
1333
-							print '<a class="reposition" href="' . $href . '">';
1333
+							print '<a class="reposition" href="'.$href.'">';
1334 1334
 							print img_picto($langs->trans('TooltipEditAndRevertStockMovement'), 'edit');
1335 1335
 							print '</a>';
1336 1336
 							print '</td>';
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 						print '<input type="hidden" name="product-'.$line->id.'-'.$i.'" value="'.$line->fk_product.'">';
1371 1371
 
1372 1372
 						// Qty
1373
-						print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-' . $line->id . '-' . $i . '" name="qty-' . $line->id . '-' . $i . '" value="' . $preselected . '" ' . $disable . '></td>';
1373
+						print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-'.$line->id.'-'.$i.'" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'" '.$disable.'></td>';
1374 1374
 
1375 1375
 						// Unit
1376 1376
 						print '<td></td>';
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
 
1883 1883
 					$.ajax({
1884 1884
 						type: "POST",
1885
-						url: "<?php echo DOL_URL_ROOT . '/mrp/ajax/interface.php'; ?>",
1885
+						url: "<?php echo DOL_URL_ROOT.'/mrp/ajax/interface.php'; ?>",
1886 1886
 						data: {
1887 1887
 							action: "updateselectbatchbywarehouse",
1888 1888
 							permissiontoproduce: <?php echo $permissiontoproduce ?>,
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
 
1944 1944
 					$.ajax({
1945 1945
 						type: "POST",
1946
-						url: "<?php echo DOL_URL_ROOT . '/mrp/ajax/interface.php'; ?>",
1946
+						url: "<?php echo DOL_URL_ROOT.'/mrp/ajax/interface.php'; ?>",
1947 1947
 						data: {
1948 1948
 							action: "updateselectwarehousebybatch",
1949 1949
 							permissiontoproduce: <?php echo $permissiontoproduce ?>,
Please login to merge, or discard this patch.
htdocs/mrp/mo_agenda.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 $langs->loadLangs(array("mrp", "other"));
41 41
 
42 42
 // Get parameters
43
-$id 		= GETPOSTINT('id');
43
+$id = GETPOSTINT('id');
44 44
 $ref        = GETPOST('ref', 'alpha');
45
-$action 	= GETPOST('action', 'aZ09');
45
+$action = GETPOST('action', 'aZ09');
46 46
 $cancel     = GETPOST('cancel', 'aZ09');
47 47
 $backtopage = GETPOST('backtopage', 'alpha');
48 48
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'moagenda'; // To manage different context of search
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 $search_rowid = GETPOST('search_rowid');
59 59
 $search_agenda_label = GETPOST('search_agenda_label');
60 60
 
61
-$limit 		= GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
61
+$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
62 62
 $sortfield	= GETPOST('sortfield', 'aZ09comma');
63 63
 $sortorder	= GETPOST('sortorder', 'aZ09comma');
64
-$page 		= GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
64
+$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
65 65
 if (empty($page) || $page == -1) {
66 66
 	$page = 0;
67 67
 }     // If $page is not defined, or '' or -1
Please login to merge, or discard this patch.
htdocs/asset/class/asset.class.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public $picto = 'asset';
53 53
 
54
-	const STATUS_DRAFT = 0; 	// In progress
55
-	const STATUS_DISPOSED = 9;	// Disposed
54
+	const STATUS_DRAFT = 0; // In progress
55
+	const STATUS_DISPOSED = 9; // Disposed
56 56
 
57 57
 	/**
58 58
 	 *  'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
@@ -607,11 +607,11 @@  discard block
 block discarded – undo
607 607
 		// Check parameters
608 608
 		$error = 0;
609 609
 		if (empty($this->id)) {
610
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
610
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
611 611
 			$error++;
612 612
 		}
613 613
 		if (empty($this->fk_asset_model)) {
614
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
614
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
615 615
 			$error++;
616 616
 		}
617 617
 		if ($error) {
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 
623 623
 		// Get depreciation options
624 624
 		//---------------------------
625
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
625
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
626 626
 		$options_model = new AssetDepreciationOptions($this->db);
627 627
 		$result = $options_model->fetchDeprecationOptions(0, $this->fk_asset_model);
628 628
 		if ($result < 0) {
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 		// Get accountancy codes
658 658
 		//---------------------------
659 659
 		if (!$error) {
660
-			require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
660
+			require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
661 661
 			$accountancy_codes_model = new AssetAccountancyCodes($this->db);
662 662
 			$result = $accountancy_codes_model->fetchAccountancyCodes(0, $this->fk_asset_model);
663 663
 			if ($result < 0) {
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 		// Check parameters
717 717
 		$error = 0;
718 718
 		if (empty($this->id)) {
719
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
719
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
720 720
 			$error++;
721 721
 		}
722 722
 		if ($error) {
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
 		*/
740 740
 
741 741
 		$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht";
742
-		$sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0) . " AS bookkeeping";
743
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
744
-		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
745
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
742
+		$sql .= ", ".$this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0)." AS bookkeeping";
743
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
744
+		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
745
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
746 746
 		$sql .= " ORDER BY ad.depreciation_date ASC";
747 747
 
748 748
 		$resql = $this->db->query($sql);
749 749
 		if (!$resql) {
750
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
750
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
751 751
 			return -1;
752 752
 		}
753 753
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 		// Check parameters
785 785
 		$error = 0;
786 786
 		if (empty($this->id)) {
787
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
787
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
788 788
 			$error++;
789 789
 		}
790 790
 		if ($error) {
@@ -806,14 +806,14 @@  discard block
 block discarded – undo
806 806
 		*/
807 807
 
808 808
 		$sql = "SELECT COUNT(*) AS has_bookkeeping";
809
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
810
-		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
811
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
809
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
810
+		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
811
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
812 812
 		$sql .= " AND iab.fk_docdet IS NOT NULL";
813 813
 
814 814
 		$resql = $this->db->query($sql);
815 815
 		if (!$resql) {
816
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
816
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
817 817
 			return -1;
818 818
 		}
819 819
 
@@ -851,28 +851,28 @@  discard block
 block discarded – undo
851 851
 		// Check parameters
852 852
 		$error = 0;
853 853
 		if (empty($this->id)) {
854
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
854
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
855 855
 			$error++;
856 856
 		}
857 857
 		if ($error) {
858 858
 			return -1;
859 859
 		}
860 860
 
861
-		$sql = "INSERT INTO " . MAIN_DB_PREFIX . "asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
861
+		$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
862 862
 		$sql .= " VALUES ( ";
863
-		$sql .= " " . (int) $this->id;
864
-		$sql .= ", '" . $this->db->escape($mode) . "'";
865
-		$sql .= ", '" . $this->db->escape($ref) . "'";
866
-		$sql .= ", '" . $this->db->idate($depreciation_date) . "'";
867
-		$sql .= ", " . (float) $depreciation_ht;
868
-		$sql .= ", " . (float) $cumulative_depreciation_ht;
869
-		$sql .= ", '" . $this->db->escape($accountancy_code_debit) . "'";
870
-		$sql .= ", '" . $this->db->escape($accountancy_code_credit) . "'";
863
+		$sql .= " ".(int) $this->id;
864
+		$sql .= ", '".$this->db->escape($mode)."'";
865
+		$sql .= ", '".$this->db->escape($ref)."'";
866
+		$sql .= ", '".$this->db->idate($depreciation_date)."'";
867
+		$sql .= ", ".(float) $depreciation_ht;
868
+		$sql .= ", ".(float) $cumulative_depreciation_ht;
869
+		$sql .= ", '".$this->db->escape($accountancy_code_debit)."'";
870
+		$sql .= ", '".$this->db->escape($accountancy_code_credit)."'";
871 871
 		$sql .= ")";
872 872
 
873 873
 		$resql = $this->db->query($sql);
874 874
 		if (!$resql) {
875
-			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine') . ': ' . $this->db->lasterror();
875
+			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine').': '.$this->db->lasterror();
876 876
 			return -1;
877 877
 		}
878 878
 
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		// Check parameters
896 896
 		$error = 0;
897 897
 		if (empty($this->id)) {
898
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
898
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
899 899
 			$error++;
900 900
 		}
901 901
 		if ($error) {
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 
905 905
 		// Get depreciation options
906 906
 		//---------------------------
907
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
907
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
908 908
 		$options = new AssetDepreciationOptions($this->db);
909 909
 		$result = $options->fetchDeprecationOptions($this->id);
910 910
 		if ($result < 0) {
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 
916 916
 		// Get accountancy codes
917 917
 		//---------------------------
918
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
918
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
919 919
 		$accountancy_codes = new AssetAccountancyCodes($this->db);
920 920
 		$result = $accountancy_codes->fetchAccountancyCodes($this->id);
921 921
 		if ($result < 0) {
@@ -931,20 +931,20 @@  discard block
 block discarded – undo
931 931
 		foreach ($options->deprecation_options as $mode_key => $fields) {
932 932
 			$modes[$mode_key] = $this->db->escape($mode_key);
933 933
 		}
934
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation";
935
-		$sql .= " WHERE fk_asset = " . (int) $this->id;
936
-		$sql .= " AND depreciation_mode NOT IN ('" . $this->db->sanitize(implode("', '", $modes)) . "')";
934
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_depreciation";
935
+		$sql .= " WHERE fk_asset = ".(int) $this->id;
936
+		$sql .= " AND depreciation_mode NOT IN ('".$this->db->sanitize(implode("', '", $modes))."')";
937 937
 
938 938
 		$resql = $this->db->query($sql);
939 939
 		if (!$resql) {
940
-			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
940
+			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
941 941
 			$error++;
942 942
 		}
943 943
 
944 944
 		if (!$error) {
945 945
 			// Get fiscal period
946
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
947
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
946
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
947
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
948 948
 			// @FIXME getCurrentPeriodOfFiscalYear return the first period found. What if there is several ? And what if not closed ? And what if end date not yet defined.
949 949
 			$dates = getCurrentPeriodOfFiscalYear($this->db, $conf, $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition);
950 950
 			$init_fiscal_period_start = $dates['date_start'];
@@ -978,17 +978,17 @@  discard block
 block discarded – undo
978 978
 				*/
979 979
 
980 980
 				$sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht";
981
-				$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
982
-				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
983
-				$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
984
-				$sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
981
+				$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
982
+				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
983
+				$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
984
+				$sql .= " AND ad.depreciation_mode = '".$this->db->escape($mode_key)."'";
985 985
 				$sql .= " AND iab.fk_docdet IS NOT NULL";
986 986
 				$sql .= " ORDER BY ad.depreciation_date DESC";
987 987
 				$sql .= " LIMIT 1";
988 988
 
989 989
 				$resql = $this->db->query($sql);
990 990
 				if (!$resql) {
991
-					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror();
991
+					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key).': '.$this->db->lasterror();
992 992
 					$error++;
993 993
 					break;
994 994
 				}
@@ -1000,28 +1000,28 @@  discard block
 block discarded – undo
1000 1000
 				}
1001 1001
 
1002 1002
 				// Set last cumulative depreciation
1003
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1004
-				$sql .= " SET total_amount_last_depreciation_ht = " . (empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1005
-				$sql .= " WHERE fk_asset = " . (int) $this->id;
1003
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1004
+				$sql .= " SET total_amount_last_depreciation_ht = ".(empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1005
+				$sql .= " WHERE fk_asset = ".(int) $this->id;
1006 1006
 				$resql = $this->db->query($sql);
1007 1007
 				if (!$resql) {
1008
-					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1008
+					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1009 1009
 					$error++;
1010 1010
 					break;
1011 1011
 				}
1012 1012
 
1013 1013
 				// Delete old lines
1014
-				$sql = "DELETE " . MAIN_DB_PREFIX . "asset_depreciation FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1015
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid";
1016
-				$sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id;
1017
-				$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
1014
+				$sql = "DELETE ".MAIN_DB_PREFIX."asset_depreciation FROM ".MAIN_DB_PREFIX."asset_depreciation";
1015
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = ".MAIN_DB_PREFIX."asset_depreciation.rowid";
1016
+				$sql .= " WHERE ".MAIN_DB_PREFIX."asset_depreciation.fk_asset = ".(int) $this->id;
1017
+				$sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.depreciation_mode = '".$this->db->escape($mode_key)."'";
1018 1018
 				$sql .= " AND ab.fk_docdet IS NULL";
1019 1019
 				if ($last_depreciation_date !== "") {
1020
-					$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''";
1020
+					$sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.ref != ''";
1021 1021
 				}
1022 1022
 				$resql = $this->db->query($sql);
1023 1023
 				if (!$resql) {
1024
-					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
1024
+					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
1025 1025
 					$error++;
1026 1026
 					break;
1027 1027
 				}
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 				// TODO fix declaration of $begin_period
1090 1090
 				$first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start;
1091 1091
 
1092
-				$ref_date_format = "%Y" . ($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '') . ($fields['duration_type'] == 2 ? '-%d' : '');
1092
+				$ref_date_format = "%Y".($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '').($fields['duration_type'] == 2 ? '-%d' : '');
1093 1093
 
1094 1094
 				// Loop security
1095 1095
 				$idx_loop = 0;
@@ -1111,9 +1111,9 @@  discard block
 block discarded – undo
1111 1111
 
1112 1112
 						$period_begin = dol_print_date($fiscal_period_start, $ref_date_format);
1113 1113
 						$period_end = dol_print_date($fiscal_period_end, $ref_date_format);
1114
-						$ref = $period_begin . ($period_begin != $period_end ? ' - ' . $period_end : '');
1114
+						$ref = $period_begin.($period_begin != $period_end ? ' - '.$period_end : '');
1115 1115
 						if ($fiscal_period_start <= $disposal_date && $disposal_date <= $fiscal_period_end) {
1116
-							$ref .= ' - ' . $langs->transnoentitiesnoconv('AssetDisposal');
1116
+							$ref .= ' - '.$langs->transnoentitiesnoconv('AssetDisposal');
1117 1117
 						}
1118 1118
 
1119 1119
 						$begin_date = $fiscal_period_start < $start_date && $start_date <= $fiscal_period_end ? $start_date : $fiscal_period_start;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 		// Check parameters
1193 1193
 		$error = 0;
1194 1194
 		if (empty($asset_depreciation_id)) {
1195
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
1195
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
1196 1196
 			$error++;
1197 1197
 		}
1198 1198
 		if ($error) {
@@ -1201,28 +1201,28 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
 		$this->db->begin();
1203 1203
 
1204
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
1204
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
1205 1205
 		$options = new AssetDepreciationOptions($this->db);
1206 1206
 
1207 1207
 		// Get last depreciation lines save in bookkeeping
1208 1208
 		//-----------------------------------------------------
1209 1209
 		$sql = "SELECT fk_asset, depreciation_mode, cumulative_depreciation_ht";
1210
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1211
-		$sql .= " WHERE rowid = " . (int) $asset_depreciation_id;
1210
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation";
1211
+		$sql .= " WHERE rowid = ".(int) $asset_depreciation_id;
1212 1212
 		$resql = $this->db->query($sql);
1213 1213
 		if (!$resql) {
1214
-			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation') . ': ' . $this->db->lasterror();
1214
+			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation').': '.$this->db->lasterror();
1215 1215
 			$error++;
1216 1216
 		} else {
1217 1217
 			if ($obj = $this->db->fetch_object($resql)) {
1218 1218
 				$mode_key = $obj->depreciation_mode;
1219 1219
 				if (!empty($options->deprecation_options_fields[$mode_key])) {
1220
-					$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1221
-					$sql .= " SET total_amount_last_depreciation_ht = " . $obj->cumulative_depreciation_ht;
1222
-					$sql .= " WHERE fk_asset = " . (int) $obj->fk_asset;
1220
+					$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1221
+					$sql .= " SET total_amount_last_depreciation_ht = ".$obj->cumulative_depreciation_ht;
1222
+					$sql .= " WHERE fk_asset = ".(int) $obj->fk_asset;
1223 1223
 					$resql = $this->db->query($sql);
1224 1224
 					if (!$resql) {
1225
-						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1225
+						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1226 1226
 						$error++;
1227 1227
 					}
1228 1228
 				}
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 			if ($option == 'label') {
1476 1476
 				$name = $this->label;
1477 1477
 			} elseif ($option == 'with_label') {
1478
-				$name .= ' - ' . $this->label;
1478
+				$name .= ' - '.$this->label;
1479 1479
 			}
1480 1480
 			$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
1481 1481
 		}
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
1485 1485
 
1486 1486
 		global $action;
1487
-		$hookmanager->initHooks(array($this->element . 'dao'));
1487
+		$hookmanager->initHooks(array($this->element.'dao'));
1488 1488
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
1489 1489
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1490 1490
 		if ($reshook > 0) {
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 		if (getDolGlobalString('ASSET_ASSET_ADDON')) {
1621 1621
 			$mybool = false;
1622 1622
 
1623
-			$file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php";
1623
+			$file = getDolGlobalString('ASSET_ASSET_ADDON').".php";
1624 1624
 			$classname = getDolGlobalString('ASSET_ASSET_ADDON');
1625 1625
 
1626 1626
 			// Include file with class
Please login to merge, or discard this patch.