Completed
Branch develop (2a2824)
by
unknown
17:28
created
htdocs/societe/class/societe.class.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
 			$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
1000 1000
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1001 1001
 				$sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1');
1002
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1003
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1002
+				$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1003
+				$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1004 1004
 			}
1005 1005
 			$sql .= ")";
1006 1006
 
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 				}
1049 1049
 
1050 1050
 				if ($ret >= 0) {
1051
-					if (! $notrigger) {
1051
+					if (!$notrigger) {
1052 1052
 						// Call trigger
1053 1053
 						$result = $this->call_trigger('COMPANY_CREATE', $user);
1054 1054
 						if ($result < 0) {
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1292 1292
 							$langs->loadLangs(array("errors", 'compta'));
1293 1293
 							$error++;
1294
-							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1294
+							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1295 1295
 						}
1296 1296
 					}
1297 1297
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1300 1300
 						$langs->loadLangs(array("errors", 'compta'));
1301 1301
 						$error++;
1302
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1302
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1303 1303
 					}
1304 1304
 				} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) {
1305 1305
 					// Check for unicity
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1308 1308
 							$langs->loadLangs(array("errors", 'compta'));
1309 1309
 							$error++;
1310
-							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1310
+							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1311 1311
 						}
1312 1312
 					}
1313 1313
 
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1316 1316
 						$langs->loadLangs(array("errors", 'compta'));
1317 1317
 						$error++;
1318
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1318
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1319 1319
 					}
1320 1320
 				}
1321 1321
 			}
@@ -1357,24 +1357,24 @@  discard block
 block discarded – undo
1357 1357
 		$now = dol_now();
1358 1358
 
1359 1359
 		// Clean parameters
1360
-		$this->id 			= $id;
1361
-		$this->entity 		= ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1360
+		$this->id = $id;
1361
+		$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1362 1362
 		$this->name 		= $this->name ? trim($this->name) : trim($this->nom);
1363 1363
 		$this->nom 			= $this->name; // For backward compatibility
1364
-		$this->name_alias 	= trim($this->name_alias);
1364
+		$this->name_alias = trim($this->name_alias);
1365 1365
 		$this->ref_ext		= trim($this->ref_ext);
1366 1366
 		$this->address		= trim($this->address);
1367 1367
 		$this->zip 			= trim($this->zip);
1368 1368
 		$this->town 		= trim($this->town);
1369
-		$this->state_id 	= (is_numeric($this->state_id)) ? (int) trim($this->state_id) : 0;
1370
-		$this->country_id 	= ($this->country_id > 0) ? $this->country_id : 0;
1369
+		$this->state_id = (is_numeric($this->state_id)) ? (int) trim($this->state_id) : 0;
1370
+		$this->country_id = ($this->country_id > 0) ? $this->country_id : 0;
1371 1371
 		$this->phone		= trim($this->phone);
1372 1372
 		$this->phone		= preg_replace("/\s/", "", $this->phone);
1373 1373
 		$this->phone		= preg_replace("/\./", "", $this->phone);
1374 1374
 		$this->fax			= trim($this->fax);
1375 1375
 		$this->fax			= preg_replace("/\s/", "", $this->fax);
1376 1376
 		$this->fax			= preg_replace("/\./", "", $this->fax);
1377
-		$this->email		= trim($this->email);
1377
+		$this->email = trim($this->email);
1378 1378
 		$this->url			= $this->url ? clean_url($this->url, 0) : '';
1379 1379
 		$this->note_private = trim($this->note_private);
1380 1380
 		$this->note_public  = trim($this->note_public);
@@ -1384,14 +1384,14 @@  discard block
 block discarded – undo
1384 1384
 		$this->idprof4		= trim($this->idprof4);
1385 1385
 		$this->idprof5		= (!empty($this->idprof5) ? trim($this->idprof5) : '');
1386 1386
 		$this->idprof6		= (!empty($this->idprof6) ? trim($this->idprof6) : '');
1387
-		$this->prefix_comm 	= trim($this->prefix_comm);
1387
+		$this->prefix_comm = trim($this->prefix_comm);
1388 1388
 		$this->outstanding_limit = price2num($this->outstanding_limit);
1389 1389
 		$this->order_min_amount = price2num($this->order_min_amount);
1390 1390
 		$this->supplier_order_min_amount = price2num($this->supplier_order_min_amount);
1391 1391
 
1392 1392
 		$this->tva_assuj			= (is_numeric($this->tva_assuj)) ? (int) trim($this->tva_assuj) : 0;
1393 1393
 		$this->tva_intra			= dol_sanitizeFileName($this->tva_intra, '');
1394
-		$this->vat_reverse_charge	= empty($this->vat_reverse_charge) ? 0 : 1;
1394
+		$this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1;
1395 1395
 		if (empty($this->status)) {
1396 1396
 			$this->status = 0;
1397 1397
 		}
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
 			$sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null");
1542 1542
 			$sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'";
1543 1543
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1544
-				$sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape($this->vat_reverse_charge) . "'" : 0);
1544
+				$sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape($this->vat_reverse_charge)."'" : 0);
1545 1545
 			}
1546 1546
 			$sql .= ",status = ".((int) $this->status);
1547 1547
 
@@ -1602,8 +1602,8 @@  discard block
 block discarded – undo
1602 1602
 			$sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null');
1603 1603
 			$sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'";
1604 1604
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1605
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1606
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1605
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1606
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1607 1607
 				if ($customer) {
1608 1608
 					$sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null");
1609 1609
 				}
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 				$this->code_client = $obj->code_client;
1962 1962
 				$this->code_fournisseur = $obj->code_fournisseur;
1963 1963
 
1964
-				$this->code_compta = $obj->code_compta;			// For backward compatibility
1964
+				$this->code_compta = $obj->code_compta; // For backward compatibility
1965 1965
 				$this->code_compta_client = $obj->code_compta;
1966 1966
 				$this->code_compta_fournisseur = $obj->code_compta_fournisseur;
1967 1967
 
@@ -1978,7 +1978,7 @@  discard block
 block discarded – undo
1978 1978
 					$this->vat_reverse_charge = 0;
1979 1979
 				}
1980 1980
 
1981
-				$this->status				= $obj->status;
1981
+				$this->status = $obj->status;
1982 1982
 
1983 1983
 				// Local Taxes
1984 1984
 				$this->localtax1_assuj      = $obj->localtax1_assuj;
@@ -2005,7 +2005,7 @@  discard block
 block discarded – undo
2005 2005
 
2006 2006
 				$this->mode_reglement_id 	= $obj->mode_reglement;
2007 2007
 				$this->cond_reglement_id 	= $obj->cond_reglement;
2008
-				$this->deposit_percent		= $obj->deposit_percent;
2008
+				$this->deposit_percent = $obj->deposit_percent;
2009 2009
 				$this->transport_mode_id 	= $obj->transport_mode;
2010 2010
 				$this->mode_reglement_supplier_id 	= $obj->mode_reglement_supplier;
2011 2011
 				$this->cond_reglement_supplier_id 	= $obj->cond_reglement_supplier;
@@ -2541,10 +2541,10 @@  discard block
 block discarded – undo
2541 2541
 					$reparray[$i]['firstname'] = $obj->firstname;
2542 2542
 					$reparray[$i]['email'] = $obj->email;
2543 2543
 					$reparray[$i]['phone'] = $obj->office_phone;
2544
-					$reparray[$i]['office_phone'] = $obj->office_phone;			// Pro phone
2544
+					$reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone
2545 2545
 					$reparray[$i]['office_fax'] = $obj->office_fax;
2546
-					$reparray[$i]['user_mobile'] = $obj->user_mobile;			// Pro mobile
2547
-					$reparray[$i]['personal_mobile'] = $obj->personal_mobile;	// Personal mobile
2546
+					$reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile
2547
+					$reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile
2548 2548
 					$reparray[$i]['job'] = $obj->job;
2549 2549
 					$reparray[$i]['statut'] = $obj->status; // deprecated
2550 2550
 					$reparray[$i]['status'] = $obj->status;
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
 			$datas['status'] = ' '.$this->getLibStatut(5);
2758 2758
 		}
2759 2759
 		if (isset($this->client) && isset($this->fournisseur)) {
2760
-			$datas['type'] = ' &nbsp; ' . $this->getTypeUrl(1);
2760
+			$datas['type'] = ' &nbsp; '.$this->getTypeUrl(1);
2761 2761
 		}
2762 2762
 		$datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name));
2763 2763
 		if (!empty($this->name_alias) && empty($noaliasinname)) {
@@ -2821,9 +2821,9 @@  discard block
 block discarded – undo
2821 2821
 		}
2822 2822
 		// show categories for this record only in ajax to not overload lists
2823 2823
 		if (!$nofetch && isModEnabled('categorie') && $this->client) {
2824
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
2824
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
2825 2825
 			$form = new Form($this->db);
2826
-			$datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
2826
+			$datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
2827 2827
 		}
2828 2828
 		if (!empty($this->code_fournisseur) && $this->fournisseur) {
2829 2829
 			$datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur;
@@ -2834,9 +2834,9 @@  discard block
 block discarded – undo
2834 2834
 		}
2835 2835
 		// show categories for this record only in ajax to not overload lists
2836 2836
 		if (!$nofetch && isModEnabled('categorie') && $this->fournisseur) {
2837
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
2837
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
2838 2838
 			$form = new Form($this->db);
2839
-			$datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
2839
+			$datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
2840 2840
 		}
2841 2841
 
2842 2842
 		$datas['divclose'] = '</div>';
@@ -3606,7 +3606,7 @@  discard block
 block discarded – undo
3606 3606
 		global $conf;
3607 3607
 
3608 3608
 		if (getDolGlobalString('SOCIETE_CODECOMPTA_ADDON')) {
3609
-			$module=getDolGlobalString('SOCIETE_CODECOMPTA_ADDON');
3609
+			$module = getDolGlobalString('SOCIETE_CODECOMPTA_ADDON');
3610 3610
 			$res = false;
3611 3611
 			$dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
3612 3612
 			foreach ($dirsociete as $dirroot) {
@@ -3729,7 +3729,7 @@  discard block
 block discarded – undo
3729 3729
 		global $langs;
3730 3730
 
3731 3731
 		if ($company_id > 0) {
3732
-			$sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id);
3732
+			$sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id);
3733 3733
 			$resql = $this->db->query($sql);
3734 3734
 			if ($resql) {
3735 3735
 				if ($obj = $this->db->fetch_object($resql)) {
@@ -4338,7 +4338,7 @@  discard block
 block discarded – undo
4338 4338
 		$country_code = $country_label = '';
4339 4339
 		if (getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) {
4340 4340
 			$tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY'));
4341
-			$country_id =  (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4341
+			$country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4342 4342
 			if (!empty($tmp[1])) {   // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label"
4343 4343
 				$country_code = $tmp[1];
4344 4344
 				$country_label = $tmp[2];
@@ -4425,7 +4425,7 @@  discard block
 block discarded – undo
4425 4425
 		$this->forme_juridique_code = getDolGlobalString('MAIN_INFO_SOCIETE_FORME_JURIDIQUE');
4426 4426
 		$this->email = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
4427 4427
 		$this->default_lang = getDolGlobalString('MAIN_LANG_DEFAULT', 'auto');
4428
-		$this->logo =getDolGlobalString('MAIN_INFO_SOCIETE_LOGO');
4428
+		$this->logo = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO');
4429 4429
 		$this->logo_small = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SMALL');
4430 4430
 		$this->logo_mini = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_MINI');
4431 4431
 		$this->logo_squarred = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED');
@@ -4926,7 +4926,7 @@  discard block
 block discarded – undo
4926 4926
 				dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors);
4927 4927
 			}
4928 4928
 			$result = $companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
4929
-			$this->last_main_doc=$companybankaccount->last_main_doc;
4929
+			$this->last_main_doc = $companybankaccount->last_main_doc;
4930 4930
 		} else {
4931 4931
 			// Positionne le modele sur le nom du modele a utiliser
4932 4932
 			if (!dol_strlen($modele)) {
@@ -5304,7 +5304,7 @@  discard block
 block discarded – undo
5304 5304
 		global $conf, $langs, $hookmanager, $user, $action;
5305 5305
 
5306 5306
 		$error = 0;
5307
-		$soc_origin = new Societe($this->db);		// The thirdparty that we will delete
5307
+		$soc_origin = new Societe($this->db); // The thirdparty that we will delete
5308 5308
 
5309 5309
 		if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
5310 5310
 			$this->error = $langs->trans('ErrorRecordNotFound');
Please login to merge, or discard this patch.