Completed
Branch develop (4cb77b)
by
unknown
26:24
created
htdocs/adherents/card.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 $action = GETPOST('action', 'aZ09');
67 67
 $cancel = GETPOST('cancel', 'alpha');
68 68
 $backtopage = GETPOST('backtopage', 'alpha');
69
-$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');	// if not set, $backtopage will be used
69
+$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
70 70
 $confirm = GETPOST('confirm', 'alpha');
71 71
 $rowid = GETPOSTINT('rowid');
72 72
 $id = GETPOST('id') ? GETPOSTINT('id') : $rowid;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		}
311 311
 		// Create new object
312 312
 		if ($result > 0 && !$error) {
313
-			$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
313
+			$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
314 314
 
315 315
 			// Change values
316 316
 			$object->civility_id = trim(GETPOST("civility_id", 'alphanohtml'));
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			$object->gender      = trim(GETPOST("gender", 'alphanohtml'));
320 320
 			$object->login       = trim(GETPOST("login", 'alphanohtml'));
321 321
 			if (GETPOSTISSET('pass')) {
322
-				$object->pass        = trim(GETPOST("pass", 'password'));	// For password, we must use 'none'
322
+				$object->pass = trim(GETPOST("pass", 'password')); // For password, we must use 'none'
323 323
 			}
324 324
 
325 325
 			$object->societe     = trim(GETPOST("societe", 'alphanohtml')); // deprecated
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 			}
375 375
 
376 376
 			// Check if we need to also synchronize password information
377
-			$nosyncuserpass = 1;	// no by default
377
+			$nosyncuserpass = 1; // no by default
378 378
 			if (GETPOSTISSET('pass')) {
379 379
 				if ($object->user_id) {	// If member is linked to a user
380
-					$nosyncuserpass = 0;	// We may try to sync password
380
+					$nosyncuserpass = 0; // We may try to sync password
381 381
 					if ($user->id == $object->user_id) {
382 382
 						if (!$user->hasRight('user', 'self', 'password')) {
383 383
 							$nosyncuserpass = 1; // Disable synchronizing
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		$email = preg_replace('/\s+/', '', GETPOST("member_email", 'aZ09arobase'));
488 488
 		$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
489 489
 		$login = GETPOST("member_login", 'alphanohtml');
490
-		$pass = GETPOST("password", 'password');	// For password, we use 'none'
490
+		$pass = GETPOST("password", 'password'); // For password, we use 'none'
491 491
 		$photo = GETPOST("photo", 'alphanohtml');
492 492
 		$morphy = GETPOST("morphy", 'alphanohtml');
493 493
 		$public = GETPOSTINT("public");
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 	}
868 868
 
869 869
 	if ($action == 'update_extras' && $permissiontoeditextra) {
870
-		$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
870
+		$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
871 871
 		$attribute_name = GETPOST('attribute', 'aZ09');
872 872
 
873 873
 		// Fill array 'array_options' with data from update form
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 		$morphys = array();
1060 1060
 		$morphys["phy"] = $langs->trans("Physical");
1061 1061
 		$morphys["mor"] = $langs->trans("Moral");
1062
-		$checkednature = ((GETPOSTISSET("morphy") || $action == 'create' )? GETPOST("morphy", 'alpha') : $object->morphy);
1062
+		$checkednature = ((GETPOSTISSET("morphy") || $action == 'create') ? GETPOST("morphy", 'alpha') : $object->morphy);
1063 1063
 
1064 1064
 		print '<tr><td class="fieldrequired">'.$langs->trans("MemberNature")."</td><td>\n";
1065 1065
 		print '<span id="spannature1" class="nonature-back spannature paddinglarge marginrightonly"><label for="phisicalinput" class="valignmiddle">'.$morphys["phy"].'<input id="phisicalinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="phy"'.($checkednature == "phy" ? ' checked="checked"' : '').'></label></span>';
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 			$maxfilesizearray = getMaxFileSizeArray();
1369 1369
 			$maxmin = $maxfilesizearray['maxmin'];
1370 1370
 			if ($maxmin > 0) {
1371
-				print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
1371
+				print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
1372 1372
 			}
1373 1373
 			print '<input type="file" class="flat" name="photo" id="photoinput">';
1374 1374
 			print '</td></tr>';
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 
1618 1618
 			if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1619 1619
 				$subject = (string) $arraydefaultmessage->topic;
1620
-				$msg	 = (string) $arraydefaultmessage->content;
1620
+				$msg = (string) $arraydefaultmessage->content;
1621 1621
 			}
1622 1622
 
1623 1623
 			$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
Please login to merge, or discard this patch.
htdocs/asset/class/asset.class.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	);
71 71
 
72 72
 
73
-	const STATUS_DRAFT = 0; 	// Draft
74
-	const STATUS_VALIDATED = 1; 	// In progress
75
-	const STATUS_DISPOSED = 9;	// Disposed
73
+	const STATUS_DRAFT = 0; // Draft
74
+	const STATUS_VALIDATED = 1; // In progress
75
+	const STATUS_DISPOSED = 9; // Disposed
76 76
 
77 77
 	/**
78 78
 	 *  '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')
@@ -628,11 +628,11 @@  discard block
 block discarded – undo
628 628
 		// Check parameters
629 629
 		$error = 0;
630 630
 		if (empty($this->id)) {
631
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
631
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
632 632
 			$error++;
633 633
 		}
634 634
 		if (empty($this->fk_asset_model)) {
635
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
635
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
636 636
 			$error++;
637 637
 		}
638 638
 		if ($error) {
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 
644 644
 		// Get depreciation options
645 645
 		//---------------------------
646
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
646
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
647 647
 		$options_model = new AssetDepreciationOptions($this->db);
648 648
 		$result = $options_model->fetchDeprecationOptions(0, $this->fk_asset_model);
649 649
 		if ($result < 0) {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		// Get accountancy codes
679 679
 		//---------------------------
680 680
 		if (!$error) {
681
-			require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
681
+			require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
682 682
 			$accountancy_codes_model = new AssetAccountancyCodes($this->db);
683 683
 			$result = $accountancy_codes_model->fetchAccountancyCodes(0, $this->fk_asset_model);
684 684
 			if ($result < 0) {
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		// Check parameters
738 738
 		$error = 0;
739 739
 		if (empty($this->id)) {
740
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
740
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
741 741
 			$error++;
742 742
 		}
743 743
 		if ($error) {
@@ -760,15 +760,15 @@  discard block
 block discarded – undo
760 760
 		*/
761 761
 
762 762
 		$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht";
763
-		$sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', '1', '0') . " AS bookkeeping";
764
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
765
-		$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";
766
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
763
+		$sql .= ", ".$this->db->ifsql('iab.fk_docdet IS NOT NULL', '1', '0')." AS bookkeeping";
764
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
765
+		$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";
766
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
767 767
 		$sql .= " ORDER BY ad.depreciation_date ASC";
768 768
 
769 769
 		$resql = $this->db->query($sql);
770 770
 		if (!$resql) {
771
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
771
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
772 772
 			return -1;
773 773
 		}
774 774
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		// Check parameters
806 806
 		$error = 0;
807 807
 		if (empty($this->id)) {
808
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
808
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
809 809
 			$error++;
810 810
 		}
811 811
 		if ($error) {
@@ -827,14 +827,14 @@  discard block
 block discarded – undo
827 827
 		*/
828 828
 
829 829
 		$sql = "SELECT COUNT(*) AS has_bookkeeping";
830
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
831
-		$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";
832
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
830
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
831
+		$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";
832
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
833 833
 		$sql .= " AND iab.fk_docdet IS NOT NULL";
834 834
 
835 835
 		$resql = $this->db->query($sql);
836 836
 		if (!$resql) {
837
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
837
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
838 838
 			return -1;
839 839
 		}
840 840
 
@@ -872,28 +872,28 @@  discard block
 block discarded – undo
872 872
 		// Check parameters
873 873
 		$error = 0;
874 874
 		if (empty($this->id)) {
875
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
875
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
876 876
 			$error++;
877 877
 		}
878 878
 		if ($error) {
879 879
 			return -1;
880 880
 		}
881 881
 
882
-		$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)";
882
+		$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)";
883 883
 		$sql .= " VALUES ( ";
884
-		$sql .= " " . (int) $this->id;
885
-		$sql .= ", '" . $this->db->escape($mode) . "'";
886
-		$sql .= ", '" . $this->db->escape($ref) . "'";
887
-		$sql .= ", '" . $this->db->idate($depreciation_date) . "'";
888
-		$sql .= ", " . (float) $depreciation_ht;
889
-		$sql .= ", " . (float) $cumulative_depreciation_ht;
890
-		$sql .= ", '" . $this->db->escape($accountancy_code_debit) . "'";
891
-		$sql .= ", '" . $this->db->escape($accountancy_code_credit) . "'";
884
+		$sql .= " ".(int) $this->id;
885
+		$sql .= ", '".$this->db->escape($mode)."'";
886
+		$sql .= ", '".$this->db->escape($ref)."'";
887
+		$sql .= ", '".$this->db->idate($depreciation_date)."'";
888
+		$sql .= ", ".(float) $depreciation_ht;
889
+		$sql .= ", ".(float) $cumulative_depreciation_ht;
890
+		$sql .= ", '".$this->db->escape($accountancy_code_debit)."'";
891
+		$sql .= ", '".$this->db->escape($accountancy_code_credit)."'";
892 892
 		$sql .= ")";
893 893
 
894 894
 		$resql = $this->db->query($sql);
895 895
 		if (!$resql) {
896
-			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine') . ': ' . $this->db->lasterror();
896
+			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine').': '.$this->db->lasterror();
897 897
 			return -1;
898 898
 		}
899 899
 
@@ -916,20 +916,20 @@  discard block
 block discarded – undo
916 916
 		// Check parameters
917 917
 		$error = 0;
918 918
 		if (empty($this->id)) {
919
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
919
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
920 920
 			$error++;
921 921
 		}
922 922
 		if ($error) {
923 923
 			return -1;
924 924
 		}
925 925
 
926
-		if (! empty($this->not_depreciated)) {
926
+		if (!empty($this->not_depreciated)) {
927 927
 			return 1;
928 928
 		}
929 929
 
930 930
 		// Get depreciation options
931 931
 		//---------------------------
932
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
932
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
933 933
 		$options = new AssetDepreciationOptions($this->db);
934 934
 		$result = $options->fetchDeprecationOptions($this->id);
935 935
 		if ($result < 0) {
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 
941 941
 		// Get accountancy codes
942 942
 		//---------------------------
943
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
943
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
944 944
 		$accountancy_codes = new AssetAccountancyCodes($this->db);
945 945
 		$result = $accountancy_codes->fetchAccountancyCodes($this->id);
946 946
 		if ($result < 0) {
@@ -956,20 +956,20 @@  discard block
 block discarded – undo
956 956
 		foreach ($options->deprecation_options as $mode_key => $fields) {
957 957
 			$modes[$mode_key] = $this->db->escape($mode_key);
958 958
 		}
959
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation";
960
-		$sql .= " WHERE fk_asset = " . (int) $this->id;
961
-		$sql .= " AND depreciation_mode NOT IN ('" . $this->db->sanitize(implode("', '", $modes)) . "')";
959
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_depreciation";
960
+		$sql .= " WHERE fk_asset = ".(int) $this->id;
961
+		$sql .= " AND depreciation_mode NOT IN ('".$this->db->sanitize(implode("', '", $modes))."')";
962 962
 
963 963
 		$resql = $this->db->query($sql);
964 964
 		if (!$resql) {
965
-			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
965
+			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
966 966
 			$error++;
967 967
 		}
968 968
 
969 969
 		if (!$error) {
970 970
 			// Get fiscal period
971
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
972
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
971
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
972
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
973 973
 			// @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.
974 974
 			$dates = getCurrentPeriodOfFiscalYear($this->db, $conf, $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition);
975 975
 			$init_fiscal_period_start = $dates['date_start'];
@@ -1003,17 +1003,17 @@  discard block
 block discarded – undo
1003 1003
 				*/
1004 1004
 
1005 1005
 				$sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht";
1006
-				$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
1007
-				$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";
1008
-				$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
1009
-				$sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
1006
+				$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
1007
+				$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";
1008
+				$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
1009
+				$sql .= " AND ad.depreciation_mode = '".$this->db->escape($mode_key)."'";
1010 1010
 				$sql .= " AND iab.fk_docdet IS NOT NULL";
1011 1011
 				$sql .= " ORDER BY ad.depreciation_date DESC";
1012 1012
 				$sql .= " LIMIT 1";
1013 1013
 
1014 1014
 				$resql = $this->db->query($sql);
1015 1015
 				if (!$resql) {
1016
-					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror();
1016
+					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key).': '.$this->db->lasterror();
1017 1017
 					$error++;
1018 1018
 					break;
1019 1019
 				}
@@ -1025,28 +1025,28 @@  discard block
 block discarded – undo
1025 1025
 				}
1026 1026
 
1027 1027
 				// Set last cumulative depreciation
1028
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1029
-				$sql .= " SET total_amount_last_depreciation_ht = " . (empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1030
-				$sql .= " WHERE fk_asset = " . (int) $this->id;
1028
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1029
+				$sql .= " SET total_amount_last_depreciation_ht = ".(empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1030
+				$sql .= " WHERE fk_asset = ".(int) $this->id;
1031 1031
 				$resql = $this->db->query($sql);
1032 1032
 				if (!$resql) {
1033
-					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1033
+					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1034 1034
 					$error++;
1035 1035
 					break;
1036 1036
 				}
1037 1037
 
1038 1038
 				// Delete old lines
1039
-				$sql = "DELETE " . MAIN_DB_PREFIX . "asset_depreciation FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1040
-				$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";
1041
-				$sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id;
1042
-				$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
1039
+				$sql = "DELETE ".MAIN_DB_PREFIX."asset_depreciation FROM ".MAIN_DB_PREFIX."asset_depreciation";
1040
+				$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";
1041
+				$sql .= " WHERE ".MAIN_DB_PREFIX."asset_depreciation.fk_asset = ".(int) $this->id;
1042
+				$sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.depreciation_mode = '".$this->db->escape($mode_key)."'";
1043 1043
 				$sql .= " AND ab.fk_docdet IS NULL";
1044 1044
 				if ($last_depreciation_date !== "") {
1045
-					$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''";
1045
+					$sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.ref != ''";
1046 1046
 				}
1047 1047
 				$resql = $this->db->query($sql);
1048 1048
 				if (!$resql) {
1049
-					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
1049
+					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
1050 1050
 					$error++;
1051 1051
 					break;
1052 1052
 				}
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 				// TODO fix declaration of $begin_period
1115 1115
 				$first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start;
1116 1116
 
1117
-				$ref_date_format = "%Y" . ($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '') . ($fields['duration_type'] == 2 ? '-%d' : '');
1117
+				$ref_date_format = "%Y".($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '').($fields['duration_type'] == 2 ? '-%d' : '');
1118 1118
 
1119 1119
 				// Loop security
1120 1120
 				$idx_loop = 0;
@@ -1136,9 +1136,9 @@  discard block
 block discarded – undo
1136 1136
 
1137 1137
 						$period_begin = dol_print_date($fiscal_period_start, $ref_date_format);
1138 1138
 						$period_end = dol_print_date($fiscal_period_end, $ref_date_format);
1139
-						$ref = $period_begin . ($period_begin != $period_end ? ' - ' . $period_end : '');
1139
+						$ref = $period_begin.($period_begin != $period_end ? ' - '.$period_end : '');
1140 1140
 						if ($fiscal_period_start <= $disposal_date && $disposal_date <= $fiscal_period_end) {
1141
-							$ref .= ' - ' . $langs->transnoentitiesnoconv('AssetDisposal');
1141
+							$ref .= ' - '.$langs->transnoentitiesnoconv('AssetDisposal');
1142 1142
 						}
1143 1143
 
1144 1144
 						$begin_date = $fiscal_period_start < $start_date && $start_date <= $fiscal_period_end ? $start_date : $fiscal_period_start;
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 		// Check parameters
1229 1229
 		$error = 0;
1230 1230
 		if (empty($asset_depreciation_id)) {
1231
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
1231
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
1232 1232
 			$error++;
1233 1233
 		}
1234 1234
 		if ($error) {
@@ -1237,28 +1237,28 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
 		$this->db->begin();
1239 1239
 
1240
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
1240
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
1241 1241
 		$options = new AssetDepreciationOptions($this->db);
1242 1242
 
1243 1243
 		// Get last depreciation lines save in bookkeeping
1244 1244
 		//-----------------------------------------------------
1245 1245
 		$sql = "SELECT fk_asset, depreciation_mode, cumulative_depreciation_ht";
1246
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1247
-		$sql .= " WHERE rowid = " . (int) $asset_depreciation_id;
1246
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation";
1247
+		$sql .= " WHERE rowid = ".(int) $asset_depreciation_id;
1248 1248
 		$resql = $this->db->query($sql);
1249 1249
 		if (!$resql) {
1250
-			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation') . ': ' . $this->db->lasterror();
1250
+			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation').': '.$this->db->lasterror();
1251 1251
 			$error++;
1252 1252
 		} else {
1253 1253
 			if ($obj = $this->db->fetch_object($resql)) {
1254 1254
 				$mode_key = $obj->depreciation_mode;
1255 1255
 				if (!empty($options->deprecation_options_fields[$mode_key])) {
1256
-					$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1257
-					$sql .= " SET total_amount_last_depreciation_ht = " . $obj->cumulative_depreciation_ht;
1258
-					$sql .= " WHERE fk_asset = " . (int) $obj->fk_asset;
1256
+					$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1257
+					$sql .= " SET total_amount_last_depreciation_ht = ".$obj->cumulative_depreciation_ht;
1258
+					$sql .= " WHERE fk_asset = ".(int) $obj->fk_asset;
1259 1259
 					$resql = $this->db->query($sql);
1260 1260
 					if (!$resql) {
1261
-						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1261
+						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1262 1262
 						$error++;
1263 1263
 					}
1264 1264
 				}
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 			if ($option == 'label') {
1512 1512
 				$name = $this->label;
1513 1513
 			} elseif ($option == 'with_label') {
1514
-				$name .= ' - ' . $this->label;
1514
+				$name .= ' - '.$this->label;
1515 1515
 			}
1516 1516
 			$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
1517 1517
 		}
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
1521 1521
 
1522 1522
 		global $action;
1523
-		$hookmanager->initHooks(array($this->element . 'dao'));
1523
+		$hookmanager->initHooks(array($this->element.'dao'));
1524 1524
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
1525 1525
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1526 1526
 		if ($reshook > 0) {
@@ -1605,12 +1605,12 @@  discard block
 block discarded – undo
1605 1605
 				$obj = $this->db->fetch_object($result);
1606 1606
 				$this->id = $obj->rowid;
1607 1607
 
1608
-				$this->user_creation_id		= $obj->fk_user_creat;
1609
-				$this->user_modification_id	= $obj->fk_user_modif;
1610
-				$this->user_validation_id	= $obj->fk_user_valid;
1611
-				$this->date_creation		= $this->db->jdate($obj->datec);
1612
-				$this->date_modification	= $this->db->jdate($obj->datem);
1613
-				$this->date_validation		= $this->db->jdate($obj->datev);
1608
+				$this->user_creation_id = $obj->fk_user_creat;
1609
+				$this->user_modification_id = $obj->fk_user_modif;
1610
+				$this->user_validation_id = $obj->fk_user_valid;
1611
+				$this->date_creation = $this->db->jdate($obj->datec);
1612
+				$this->date_modification = $this->db->jdate($obj->datem);
1613
+				$this->date_validation = $this->db->jdate($obj->datev);
1614 1614
 			}
1615 1615
 
1616 1616
 			$this->db->free($result);
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 		if (getDolGlobalString('ASSET_ASSET_ADDON')) {
1652 1652
 			$mybool = false;
1653 1653
 
1654
-			$file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php";
1654
+			$file = getDolGlobalString('ASSET_ASSET_ADDON').".php";
1655 1655
 			$classname = getDolGlobalString('ASSET_ASSET_ADDON');
1656 1656
 
1657 1657
 			// Include file with class
Please login to merge, or discard this patch.