Completed
Branch develop (35d0a6)
by
unknown
23:15
created
htdocs/compta/facture/class/facture.class.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			$this->mode_reglement_id = 0;
505 505
 		}
506 506
 		$this->status = self::STATUS_DRAFT;
507
-		$this->statut = self::STATUS_DRAFT;	// deprecated
507
+		$this->statut = self::STATUS_DRAFT; // deprecated
508 508
 
509 509
 		if (!empty($this->multicurrency_code)) {
510 510
 			// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 			if (!empty($_facrec->frequency)) {  // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarily when there is no recurrence.
579 579
 				$this->socid = $_facrec->socid;
580 580
 			}
581
-			$this->entity            = $_facrec->entity; // Invoice created in same entity than template
581
+			$this->entity = $_facrec->entity; // Invoice created in same entity than template
582 582
 
583 583
 			// Fields coming from GUI.
584 584
 			// @TODO Value of template should be used as default value on the form on the GUI, and we should here always use the value from GUI
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 				$this->mode_reglement_id = 0;
618 618
 			}
619 619
 			$this->status = self::STATUS_DRAFT;
620
-			$this->statut = self::STATUS_DRAFT;	// deprecated
620
+			$this->statut = self::STATUS_DRAFT; // deprecated
621 621
 
622 622
 			$this->linked_objects = $_facrec->linkedObjectsIds;
623 623
 			// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 
864 864
 						// Complete vat rate with code
865 865
 						$vatrate = $newinvoiceline->tva_tx;
866
-						if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
866
+						if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) {
867 867
 							$vatrate .= ' ('.$newinvoiceline->vat_src_code.')';
868 868
 						}
869 869
 
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 						($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) ? $previousdaynextdatewhen : '',
1084 1084
 						0,
1085 1085
 						$tva_npr,
1086
-						0,  // fk_remise_except
1086
+						0, // fk_remise_except
1087 1087
 						'HT',
1088 1088
 						0,
1089 1089
 						$_facrec->lines[$i]->product_type,
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
 						$buyprice,
1097 1097
 						$_facrec->lines[$i]->label,
1098 1098
 						empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options,
1099
-						100,	// situation percent is undefined on recurring invoice lines
1100
-						0,  // fk_prev_id
1099
+						100, // situation percent is undefined on recurring invoice lines
1100
+						0, // fk_prev_id
1101 1101
 						$_facrec->lines[$i]->fk_unit,
1102 1102
 						$_facrec->lines[$i]->multicurrency_subprice,
1103 1103
 						$_facrec->lines[$i]->ref_ext,
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 		$facture->fk_facture_source = $this->fk_facture_source;
1191 1191
 		$facture->type 			    = $this->type;
1192
-		$facture->subtype 			= $this->subtype;
1192
+		$facture->subtype = $this->subtype;
1193 1193
 		$facture->socid 		    = $this->socid;
1194 1194
 		$facture->date              = $this->date;
1195 1195
 		$facture->date_pointoftax   = $this->date_pointoftax;
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 
1207 1207
 		$facture->origin            = $this->origin;
1208 1208
 		$facture->origin_id         = $this->origin_id;
1209
-		$facture->fk_account         = $this->fk_account;
1209
+		$facture->fk_account = $this->fk_account;
1210 1210
 
1211 1211
 		$facture->lines = $this->lines; // Array of lines of invoice
1212 1212
 		$facture->situation_counter = $this->situation_counter;
@@ -1473,8 +1473,8 @@  discard block
 block discarded – undo
1473 1473
 		$this->fk_account = $object->fk_account;
1474 1474
 		$this->cond_reglement_id    = $object->cond_reglement_id;
1475 1475
 		$this->mode_reglement_id    = $object->mode_reglement_id;
1476
-		$this->fk_incoterms    		= $object->fk_incoterms;
1477
-		$this->location_incoterms	= $object->location_incoterms;
1476
+		$this->fk_incoterms = $object->fk_incoterms;
1477
+		$this->location_incoterms = $object->location_incoterms;
1478 1478
 		$this->availability_id      = $object->availability_id;
1479 1479
 		$this->demand_reason_id     = $object->demand_reason_id;
1480 1480
 		$this->delivery_date        = $object->delivery_date;
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 	{
1683 1683
 		global $conf, $langs, $hookmanager, $action;
1684 1684
 
1685
-		if (! in_array($origin->element, array('propal', 'commande'))) {
1685
+		if (!in_array($origin->element, array('propal', 'commande'))) {
1686 1686
 			$origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder';
1687 1687
 			return null;
1688 1688
 		}
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 			return null;
1693 1693
 		}
1694 1694
 
1695
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
1695
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
1696 1696
 
1697 1697
 		if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + getDolGlobalInt('INVOICE_MAX_FUTURE_DELAY'))) {
1698 1698
 			$origin->error = 'ErrorDateIsInFuture';
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 		$deposit->pos_source = $origin->pos_source;
1737 1737
 		$deposit->model_pdf = 'crabe';
1738 1738
 
1739
-		$modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type;
1739
+		$modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type;
1740 1740
 
1741 1741
 		if (getDolGlobalString($modelByTypeConfName)) {
1742 1742
 			$deposit->model_pdf = getDolGlobalString($modelByTypeConfName);
@@ -1796,10 +1796,10 @@  discard block
 block discarded – undo
1796 1796
 					$descriptions[$key] = '';
1797 1797
 				}
1798 1798
 				$TTotalByTva[$key] += $line->total_ttc;
1799
-				$descriptions[$key] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : '');
1800
-				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label . ' - ' : '');
1801
-				$descriptions[$key] .= $langs->trans('Qty') . ' : ' . $line->qty;
1802
-				$descriptions[$key] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>';
1799
+				$descriptions[$key] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : '');
1800
+				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label.' - ' : '');
1801
+				$descriptions[$key] .= $langs->trans('Qty').' : '.$line->qty;
1802
+				$descriptions[$key] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>';
1803 1803
 			}
1804 1804
 
1805 1805
 			foreach ($TTotalByTva as $tva => &$total) {
@@ -1823,10 +1823,10 @@  discard block
 block discarded – undo
1823 1823
 				$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
1824 1824
 				$tva_tx = $lines[$i]->tva_tx;
1825 1825
 				$amountdeposit[$tva_tx] += ((float) $lines[$i]->total_ht * (float) $origin->deposit_percent) / 100;
1826
-				$descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : '');
1827
-				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : '');
1828
-				$descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty;
1829
-				$descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>';
1826
+				$descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : '');
1827
+				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : '');
1828
+				$descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty;
1829
+				$descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>';
1830 1830
 			}
1831 1831
 
1832 1832
 			if ($totalamount == 0) {
@@ -1841,11 +1841,11 @@  discard block
 block discarded – undo
1841 1841
 				continue;
1842 1842
 			}
1843 1843
 
1844
-			$descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref;
1844
+			$descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref;
1845 1845
 
1846 1846
 			// Hidden conf
1847 1847
 			if (getDolGlobalString('INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION') && !empty($descriptions[$tva])) {
1848
-				$descline .= '<ul>' . $descriptions[$tva] . '</ul>';
1848
+				$descline .= '<ul>'.$descriptions[$tva].'</ul>';
1849 1849
 			}
1850 1850
 
1851 1851
 			$addlineResult = $deposit->addline(
@@ -2225,9 +2225,9 @@  discard block
 block discarded – undo
2225 2225
 				$this->id = $obj->rowid;
2226 2226
 				$this->entity = $obj->entity;
2227 2227
 
2228
-				$this->ref					= $obj->ref;
2229
-				$this->ref_client			= $obj->ref_client;
2230
-				$this->ref_customer			= $obj->ref_client;
2228
+				$this->ref = $obj->ref;
2229
+				$this->ref_client = $obj->ref_client;
2230
+				$this->ref_customer = $obj->ref_client;
2231 2231
 				$this->ref_ext				= $obj->ref_ext;
2232 2232
 				$this->type					= $obj->type;
2233 2233
 				$this->subtype				= $obj->subtype;
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
 				$this->fk_project = $obj->fk_project;
2254 2254
 				$this->project = null; // Clear if another value was already set by fetch_projet
2255 2255
 
2256
-				$this->statut = $obj->status;	// deprecated
2256
+				$this->statut = $obj->status; // deprecated
2257 2257
 				$this->status = $obj->status;
2258 2258
 
2259 2259
 				$this->date_lim_reglement = $this->db->jdate($obj->dlr);
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
 				$this->fk_fac_rec_source	= $obj->fk_fac_rec_source;
2270 2270
 				$this->note = $obj->note_private; // deprecated
2271 2271
 				$this->note_private = $obj->note_private;
2272
-				$this->note_public			= $obj->note_public;
2272
+				$this->note_public = $obj->note_public;
2273 2273
 				$this->user_creation_id     = $obj->fk_user_author;
2274 2274
 				$this->user_validation_id   = $obj->fk_user_valid;
2275 2275
 				$this->user_modification_id = $obj->fk_user_modif;
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 				$line->ref              = $objp->product_ref; // Ref product
2384 2384
 				$line->product_ref      = $objp->product_ref; // Ref product
2385 2385
 				$line->libelle          = $objp->product_label; // deprecated
2386
-				$line->product_label 	= $objp->product_label; // Label product
2386
+				$line->product_label = $objp->product_label; // Label product
2387 2387
 				$line->product_barcode  = $objp->product_barcode; // Barcode number product
2388 2388
 				$line->product_desc     = $objp->product_desc; // Description product
2389 2389
 				$line->fk_product_type  = $objp->fk_product_type; // Type of product
@@ -3257,10 +3257,10 @@  discard block
 block discarded – undo
3257 3257
 		if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'creer'))
3258 3258
 		|| (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'invoice_advance', 'validate'))) {
3259 3259
 			$this->error = 'Permission denied';
3260
-			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3260
+			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3261 3261
 			return -1;
3262 3262
 		}
3263
-		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) &&	// empty should not happened, but when it occurs, the test save life
3263
+		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
3264 3264
 			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')						// If option enabled, we force invoice date
3265 3265
 		) {
3266 3266
 			$this->date = dol_now();
@@ -3438,7 +3438,7 @@  discard block
 block discarded – undo
3438 3438
 					for ($i = 0; $i < $cpt; $i++) {
3439 3439
 						if ($this->lines[$i]->fk_product > 0) {
3440 3440
 							$mouvP = new MouvementStock($this->db);
3441
-							$mouvP->origin = &$this;	// deprecated
3441
+							$mouvP->origin = &$this; // deprecated
3442 3442
 							$mouvP->setOrigin($this->element, $this->id);
3443 3443
 
3444 3444
 							// We decrease stock for product
@@ -3632,7 +3632,7 @@  discard block
 block discarded – undo
3632 3632
 			// Set new ref and define current status
3633 3633
 			if (!$error) {
3634 3634
 				$this->ref = $num;
3635
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
3635
+				$this->statut = self::STATUS_VALIDATED; // deprecated
3636 3636
 				$this->status = self::STATUS_VALIDATED;
3637 3637
 				$this->date_validation = $now;
3638 3638
 				$i = 0;
@@ -3787,7 +3787,7 @@  discard block
 block discarded – undo
3787 3787
 
3788 3788
 			if ($error == 0) {
3789 3789
 				$old_statut = $this->status;
3790
-				$this->statut = self::STATUS_DRAFT;	// deprecated
3790
+				$this->statut = self::STATUS_DRAFT; // deprecated
3791 3791
 				$this->status = self::STATUS_DRAFT;
3792 3792
 
3793 3793
 				// Call trigger
@@ -4692,7 +4692,7 @@  discard block
 block discarded – undo
4692 4692
 		}
4693 4693
 
4694 4694
 		if (!empty($addon)) {
4695
-			dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4695
+			dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4696 4696
 
4697 4697
 			$mybool = false;
4698 4698
 
@@ -5159,7 +5159,7 @@  discard block
 block discarded – undo
5159 5159
 
5160 5160
 		if (empty($option) || $option != 'nolines') {
5161 5161
 			// Lines
5162
-			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5);	// We can force the nb of lines to test from command line (but not more than 1000)
5162
+			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000)
5163 5163
 			$xnbp = 0;
5164 5164
 			while ($xnbp < $nbp) {
5165 5165
 				$line = new FactureLigne($this->db);
@@ -5772,14 +5772,14 @@  discard block
 block discarded – undo
5772 5772
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5773 5773
 			$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
5774 5774
 		}
5775
-		$sql .= " WHERE f.paye = 0";	// Only unpaid
5776
-		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;	// Only validated status
5775
+		$sql .= " WHERE f.paye = 0"; // Only unpaid
5776
+		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status
5777 5777
 		if ($datetouse == 'invoicedate') {
5778 5778
 			$sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";
5779 5779
 		} else {
5780 5780
 			$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
5781 5781
 		}
5782
-		$sql .= " AND f.entity IN (".getEntity('facture', 0).")";	// One batch process only one company (no sharing)
5782
+		$sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing)
5783 5783
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5784 5784
 			$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
5785 5785
 		}
@@ -5997,7 +5997,7 @@  discard block
 block discarded – undo
5997 5997
 								$actioncomm->create($user);
5998 5998
 							}
5999 5999
 
6000
-							$this->db->commit();	// We always commit
6000
+							$this->db->commit(); // We always commit
6001 6001
 						}
6002 6002
 
6003 6003
 						if ($errormesg) {
@@ -6039,7 +6039,7 @@  discard block
 block discarded – undo
6039 6039
 		// get date of last validated invoices of same type
6040 6040
 		$sql  = "SELECT datef";
6041 6041
 		$sql .= " FROM ".MAIN_DB_PREFIX."facture";
6042
-		$sql .= " WHERE type = " . (int) $this->type ;
6042
+		$sql .= " WHERE type = ".(int) $this->type;
6043 6043
 		$sql .= " AND date_valid IS NOT NULL";
6044 6044
 		$sql .= " AND entity IN (".getEntity('invoice').")";
6045 6045
 		$sql .= " ORDER BY datef DESC LIMIT 1";
Please login to merge, or discard this patch.
dev/tools/phan/config.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	'bom' => 'Bom',
80 80
 	'bookcal' => 'BookCal',
81 81
 	'bookmark' => 'Bookmark',
82
-	'cashdesk' => null,  // TODO: fill in proper class
82
+	'cashdesk' => null, // TODO: fill in proper class
83 83
 	'category' => 'Categorie',
84 84
 	'clicktodial' => 'ClickToDial',
85 85
 	'collab' => 'Collab',
86 86
 	'comptabilite' => 'Comptabilite',
87
-	'contact' => null,  // TODO: fill in proper class
87
+	'contact' => null, // TODO: fill in proper class
88 88
 	'contract' => 'Contrat',
89 89
 	'cron' => 'Cron',
90 90
 	'datapolicy' => 'DataPolicy',
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	'don' => 'Don',
97 97
 	'dynamicprices' => 'DynamicPrices',
98 98
 	'ecm' => 'ECM',
99
-	'ecotax' => null,  // TODO: External module ?
99
+	'ecotax' => null, // TODO: External module ?
100 100
 	'emailcollector' => 'EmailCollector',
101 101
 	'eventorganization' => 'EventOrganization',
102 102
 	'expensereport' => 'ExpenseReport',
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	'fournisseur' => 'Fournisseur',
108 108
 	'ftp' => 'FTP',
109 109
 	'geoipmaxmind' => 'GeoIPMaxmind',
110
-	'google' => null,  // External ?
110
+	'google' => null, // External ?
111 111
 	'gravatar' => 'Gravatar',
112 112
 	'holiday' => 'Holiday',
113 113
 	'hrm' => 'HRM',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	'ldap' => 'Ldap',
122 122
 	'loan' => 'Loan',
123 123
 	'mailing' => 'Mailing',
124
-	'mailman' => null,  // Same module as mailmanspip -> MailmanSpip ??
124
+	'mailman' => null, // Same module as mailmanspip -> MailmanSpip ??
125 125
 	'mailmanspip' => 'MailmanSpip',
126 126
 	'margin' => 'Margin',
127 127
 	'member' => 'Adherent',
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	'notification' => 'Notification',
135 135
 	'numberwords' => null, // Not provided by default, no module tests
136 136
 	'oauth' => 'OAuth',
137
-	'openstreetmap' => null,  // External module?
137
+	'openstreetmap' => null, // External module?
138 138
 	'opensurvey' => 'OpenSurvey',
139 139
 	'order' => 'Commande',
140 140
 	'partnership' => 'Partnership',
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	'stock' => 'Stock',
162 162
 	'stocktransfer' => 'StockTransfer',
163 163
 	'stripe' => 'Stripe',
164
-	'supplier_invoice' => null,  // Special case, uses invoice
165
-	'supplier_order' => null,  // Special case, uses invoice
164
+	'supplier_invoice' => null, // Special case, uses invoice
165
+	'supplier_order' => null, // Special case, uses invoice
166 166
 	'supplier_proposal' => 'SupplierProposal',
167 167
 	'syslog' => 'Syslog',
168 168
 	'takepos' => 'TakePos',
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	//	'processes' => 6,
225 225
 	'backward_compatibility_checks' => false,
226 226
 	'simplify_ast' => true,
227
-	'analyzed_file_extensions' => ['php','inc'],
227
+	'analyzed_file_extensions' => ['php', 'inc'],
228 228
 	'globals_type_map' => [
229 229
 		'_Avery_Labels' => 'array<string,array{name:string,paper-size:string|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float}>',
230 230
 		'action' => 'string',
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		'shmkeys' => 'array<string,int>', // memory.lib
284 284
 		'shmoffset' => 'int', // memory.lib
285 285
 		'user' => '\User',
286
-		'website' => 'string',  // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334  // Disable because Phan infers Website type
286
+		'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334  // Disable because Phan infers Website type
287 287
 		'websitepage' => '\WebSitePage',
288 288
 		'websitepagefile' => 'string',
289 289
 		// 'object' => '\CommonObject',  // Deprecated, not enabled because conflicts with $object assignments
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	'directory_list' => [
309 309
 		'htdocs',
310 310
 		'scripts',
311
-		PHAN_DIR . '/stubs',
311
+		PHAN_DIR.'/stubs',
312 312
 	],
313 313
 
314 314
 	// A directory list that defines files that will be excluded
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		'htdocs/includes/',
327 327
 		'htdocs/install/doctemplates/websites/',
328 328
 		'htdocs/core/class/lessc.class.php', // External library
329
-		PHAN_DIR . '/stubs/',
329
+		PHAN_DIR.'/stubs/',
330 330
 	],
331 331
 	//'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
332 332
 	'exclude_file_regex' => '@^('  // @phpstan-ignore-line
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 		.'|htdocs/includes/stripe/.*'  // @phpstan-ignore-line
345 345
 		.'|htdocs/conf/conf.php'  // @phpstan-ignore-line
346 346
 		// .'|htdocs/[^h].*/.*'  // For testing @phpstan-ignore-line
347
-		.')@',  // @phpstan-ignore-line
347
+		.')@', // @phpstan-ignore-line
348 348
 
349 349
 	// A list of plugin files to execute.
350 350
 	// Plugins which are bundled with Phan can be added here by providing their name
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 		'/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'],
361 361
 		// Note: trick to have different key for same regex:
362 362
 		'/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
363
-		'/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"],
364
-		'/^checkVal$/' => [1, $sanitizeRegex,"UnknownCheckValSanitizeType"],
365
-		'/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex,"UnknownExtrafieldTypeBack"],
366
-		'/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}',"InvalidDolNowArgument"],
367
-		'/^dol_mktime$/' => [6, '{^(?:|0|1|auto|gmt|tz(?:server|ref|user(?:rel)?|,[+a-zA-Z-/]+))$}',"InvalidDolMktimeArgument"],  // '', 0, 1 match bool and int values
368
-		'/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}',"InvalidDolMktimeArgument"],  // '', 0, 1 match bool and int values
369
-		'/^GETPOSTFLOAT$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidGetPostFloatRounding"],
370
-		'/^price2num$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidPrice2NumRounding"],
363
+		'/^sanitizeVal$/' => [1, $sanitizeRegex, "UnknownSanitizeType"],
364
+		'/^checkVal$/' => [1, $sanitizeRegex, "UnknownCheckValSanitizeType"],
365
+		'/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex, "UnknownExtrafieldTypeBack"],
366
+		'/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}', "InvalidDolNowArgument"],
367
+		'/^dol_mktime$/' => [6, '{^(?:|0|1|auto|gmt|tz(?:server|ref|user(?:rel)?|,[+a-zA-Z-/]+))$}', "InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values
368
+		'/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}', "InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values
369
+		'/^GETPOSTFLOAT$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}', "InvalidGetPostFloatRounding"],
370
+		'/^price2num$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}', "InvalidPrice2NumRounding"],
371 371
 	],
372 372
 	'plugins' => [
373 373
 		__DIR__.'/plugins/NoVarDumpPlugin.php',
@@ -428,44 +428,44 @@  discard block
 block discarded – undo
428 428
 		// Dolibarr uses a lot of internal deprecated stuff, not reporting
429 429
 		'PhanDeprecatedProperty',
430 430
 
431
-		'PhanCompatibleNegativeStringOffset',	// return false positive
432
-		'PhanPluginConstantVariableBool',		// a lot of false positive, in most cases, we want to keep the code as it is
431
+		'PhanCompatibleNegativeStringOffset', // return false positive
432
+		'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
433 433
 		// 'PhanPluginUnknownArrayPropertyType', // Helps find missing array keys or mismatches, remaining occurrences are likely unused properties
434
-		'PhanTypeArraySuspiciousNullable',	// About 440 occurrences
434
+		'PhanTypeArraySuspiciousNullable', // About 440 occurrences
435 435
 		// 'PhanTypeInvalidDimOffset',			// Helps identify missing array indexes in types or reference to unset indexes
436 436
 		'PhanTypeObjectUnsetDeclaredProperty',
437
-		'PhanTypePossiblyInvalidDimOffset',			// a lot of false positive, in most cases, we want to keep the code as it is
437
+		'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is
438 438
 		// 'PhanPluginUnknownArrayFunctionReturnType',	// a lot of false positive, in most cases, we want to keep the code as it is
439 439
 
440
-		'PhanPluginWhitespaceTab',		// Dolibarr uses tabs
441
-		'PhanPluginCanUsePHP71Void',	// Dolibarr is maintaining 7.0 compatibility
442
-		'PhanPluginShortArray',			// Dolibarr uses array()
443
-		'PhanPluginShortArrayList',		// Dolibarr uses array()
440
+		'PhanPluginWhitespaceTab', // Dolibarr uses tabs
441
+		'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility
442
+		'PhanPluginShortArray', // Dolibarr uses array()
443
+		'PhanPluginShortArrayList', // Dolibarr uses array()
444 444
 		// Fixers From PHPDocToRealTypesPlugin:
445
-		'PhanPluginCanUseParamType',			// Fixer - Report/Add types in the function definition (function abc(string $var) (adds string)
446
-		'PhanPluginCanUseReturnType',			// Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string)
447
-		'PhanPluginCanUseNullableParamType',	// Fixer - Report/Add nullable parameter types in the function definition
448
-		'PhanPluginCanUseNullableReturnType',	// Fixer - Report/Add nullable return types in the function definition
445
+		'PhanPluginCanUseParamType', // Fixer - Report/Add types in the function definition (function abc(string $var) (adds string)
446
+		'PhanPluginCanUseReturnType', // Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string)
447
+		'PhanPluginCanUseNullableParamType', // Fixer - Report/Add nullable parameter types in the function definition
448
+		'PhanPluginCanUseNullableReturnType', // Fixer - Report/Add nullable return types in the function definition
449 449
 
450
-		'PhanPluginNonBoolBranch',			// Not essential - 31240+ occurrences
451
-		'PhanPluginNumericalComparison',	// Not essential - 19870+ occurrences
450
+		'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences
451
+		'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences
452 452
 		// 'PhanTypeMismatchArgument',		// Can detect missing array keys, invalid types, objects being passed when scalar expected - Not all reported by phpstan - <=3800 cases (was: 12300+ before)
453
-		'PhanPluginNonBoolInLogicalArith',	// Not essential - 11040+ occurrences
454
-		'PhanPluginConstantVariableScalar',	// Not essential - 5180+ occurrences
453
+		'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences
454
+		'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences
455 455
 		'PhanPluginDuplicateAdjacentStatement',
456
-		'PhanPluginDuplicateConditionalTernaryDuplication',		// 2750+ occurrences
457
-		'PhanPluginDuplicateConditionalNullCoalescing',	// Not essential - 990+ occurrences
458
-		'PhanPluginRedundantAssignmentInGlobalScope',	// Not essential, a lot of false warning
459
-		'PhanPluginRedundantAssignment',				// Not essential, useless
460
-		'PhanPluginDuplicateCatchStatementBody',  // Requires PHP7.1 - 50+ occurrences
456
+		'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences
457
+		'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences
458
+		'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning
459
+		'PhanPluginRedundantAssignment', // Not essential, useless
460
+		'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences
461 461
 
462
-		'PhanPluginUnknownClosureReturnType',	// When we use closure (we must avoid), we do not have PHP doc
462
+		'PhanPluginUnknownClosureReturnType', // When we use closure (we must avoid), we do not have PHP doc
463 463
 
464 464
 		// 'PhanPluginUnknownArrayMethodParamType',	// All fixed
465 465
 		// 'PhanPluginUnknownArrayMethodReturnType',	// All fixed
466 466
 		// 'PhanUndeclaredGlobalVariable',			// Helps identify variables that are not set/defined - add '@phan-var-force TYPE $varname' in tpl or includes to help type the variable
467 467
 		// 'PhanPluginUnknownObjectMethodCall',	// False positive for some class. Is enabled in config_extended only.
468
-		'PhanTypeSuspiciousNonTraversableForeach',  // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code.
468
+		'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code.
469 469
 	],
470 470
 	// You can put relative paths to internal stubs in this config option.
471 471
 	// Phan will continue using its detailed type annotations,
@@ -484,31 +484,31 @@  discard block
 block discarded – undo
484 484
 		//'xdebug'	=> 'vendor/phan/phan/.phan/internal_stubs/xdebug.phan_php',
485 485
 		//'memcached'  => PHAN_DIR . '/your_internal_stubs_folder_name/memcached.phan_php',
486 486
 		//'PDO'  => PHAN_DIR . '/stubs/PDO.phan_php',
487
-		'brotli'  => PHAN_DIR . '/stubs/brotli.phan_php',
488
-		'curl'  => PHAN_DIR . '/stubs/curl.phan_php',
489
-		'calendar'  => PHAN_DIR . '/stubs/calendar.phan_php',
490
-		'fileinfo'  => PHAN_DIR . '/stubs/fileinfo.phan_php',
491
-		'ftp'  => PHAN_DIR . '/stubs/ftp.phan_php',
492
-		'gd'  => PHAN_DIR . '/stubs/gd.phan_php',
493
-		'geoip'  => PHAN_DIR . '/stubs/geoip.phan_php',
494
-		'imagick'  => PHAN_DIR . '/stubs/imagick.phan_php',
495
-		'imap'  => PHAN_DIR . '/stubs/imap.phan_php',
496
-		'intl'  => PHAN_DIR . '/stubs/intl.phan_php',
497
-		'ldap'  => PHAN_DIR . '/stubs/ldap.phan_php',
498
-		'mcrypt'  => PHAN_DIR . '/stubs/mcrypt.phan_php',
499
-		'memcache'  => PHAN_DIR . '/stubs/memcache.phan_php',
500
-		'memcached' => PHAN_DIR . '/stubs/memcached.phan_php',
501
-		'mysqli'  => PHAN_DIR . '/stubs/mysqli.phan_php',
502
-		'pdo_cubrid'  => PHAN_DIR . '/stubs/pdo_cubrid.phan_php',
503
-		'pdo_mysql'  => PHAN_DIR . '/stubs/pdo_mysql.phan_php',
504
-		'pdo_pgsql'  => PHAN_DIR . '/stubs/pdo_pgsql.phan_php',
505
-		'pdo_sqlite'  => PHAN_DIR . '/stubs/pdo_sqlite.phan_php',
506
-		'pgsql'  => PHAN_DIR . '/stubs/pgsql.phan_php',
507
-		'session'  => PHAN_DIR . '/stubs/session.phan_php',
508
-		'simplexml'  => PHAN_DIR . '/stubs/SimpleXML.phan_php',
509
-		'soap'  => PHAN_DIR . '/stubs/soap.phan_php',
510
-		'sockets'  => PHAN_DIR . '/stubs/sockets.phan_php',
511
-		'tidy'  => PHAN_DIR . '/stubs/tidy.phan_php',
512
-		'zip'  => PHAN_DIR . '/stubs/zip.phan_php',
487
+		'brotli'  => PHAN_DIR.'/stubs/brotli.phan_php',
488
+		'curl'  => PHAN_DIR.'/stubs/curl.phan_php',
489
+		'calendar'  => PHAN_DIR.'/stubs/calendar.phan_php',
490
+		'fileinfo'  => PHAN_DIR.'/stubs/fileinfo.phan_php',
491
+		'ftp'  => PHAN_DIR.'/stubs/ftp.phan_php',
492
+		'gd'  => PHAN_DIR.'/stubs/gd.phan_php',
493
+		'geoip'  => PHAN_DIR.'/stubs/geoip.phan_php',
494
+		'imagick'  => PHAN_DIR.'/stubs/imagick.phan_php',
495
+		'imap'  => PHAN_DIR.'/stubs/imap.phan_php',
496
+		'intl'  => PHAN_DIR.'/stubs/intl.phan_php',
497
+		'ldap'  => PHAN_DIR.'/stubs/ldap.phan_php',
498
+		'mcrypt'  => PHAN_DIR.'/stubs/mcrypt.phan_php',
499
+		'memcache'  => PHAN_DIR.'/stubs/memcache.phan_php',
500
+		'memcached' => PHAN_DIR.'/stubs/memcached.phan_php',
501
+		'mysqli'  => PHAN_DIR.'/stubs/mysqli.phan_php',
502
+		'pdo_cubrid'  => PHAN_DIR.'/stubs/pdo_cubrid.phan_php',
503
+		'pdo_mysql'  => PHAN_DIR.'/stubs/pdo_mysql.phan_php',
504
+		'pdo_pgsql'  => PHAN_DIR.'/stubs/pdo_pgsql.phan_php',
505
+		'pdo_sqlite'  => PHAN_DIR.'/stubs/pdo_sqlite.phan_php',
506
+		'pgsql'  => PHAN_DIR.'/stubs/pgsql.phan_php',
507
+		'session'  => PHAN_DIR.'/stubs/session.phan_php',
508
+		'simplexml'  => PHAN_DIR.'/stubs/SimpleXML.phan_php',
509
+		'soap'  => PHAN_DIR.'/stubs/soap.phan_php',
510
+		'sockets'  => PHAN_DIR.'/stubs/sockets.phan_php',
511
+		'tidy'  => PHAN_DIR.'/stubs/tidy.phan_php',
512
+		'zip'  => PHAN_DIR.'/stubs/zip.phan_php',
513 513
 	],
514 514
 ];
Please login to merge, or discard this patch.
dev/tools/phan/config_extended.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -66,40 +66,40 @@
 block discarded – undo
66 66
 		// Dolibarr uses a lot of internal deprecated stuff, not reporting
67 67
 		'PhanDeprecatedProperty',
68 68
 
69
-		'PhanCompatibleNegativeStringOffset',	// return false positive
70
-		'PhanPluginConstantVariableBool',		// a lot of false positive, in most cases, we want to keep the code as it is
69
+		'PhanCompatibleNegativeStringOffset', // return false positive
70
+		'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
71 71
 		// 'PhanPluginUnknownArrayPropertyType', // Helps find missing array keys or mismatches, remaining occurrences are likely unused properties
72
-		'PhanTypeArraySuspiciousNullable',	// About 400 cases
72
+		'PhanTypeArraySuspiciousNullable', // About 400 cases
73 73
 		// 'PhanTypeInvalidDimOffset',			// Helps identify missing array indexes in types or reference to unset indexes
74 74
 		'PhanTypeObjectUnsetDeclaredProperty',
75
-		'PhanTypePossiblyInvalidDimOffset',		// a lot of false positive, in most cases, we want to keep the code as it is
76
-		'PhanPluginUnknownArrayFunctionReturnType',	// a lot of false positive, in most cases, we want to keep the code as it is
75
+		'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is
76
+		'PhanPluginUnknownArrayFunctionReturnType', // a lot of false positive, in most cases, we want to keep the code as it is
77 77
 
78
-		'PhanPluginWhitespaceTab',		// Dolibarr used tabs
79
-		'PhanPluginCanUsePHP71Void',	// Dolibarr is maintaining 7.0 compatibility
80
-		'PhanPluginShortArray',			// Dolibarr uses array()
81
-		'PhanPluginShortArrayList',		// Dolibarr uses array()
78
+		'PhanPluginWhitespaceTab', // Dolibarr used tabs
79
+		'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility
80
+		'PhanPluginShortArray', // Dolibarr uses array()
81
+		'PhanPluginShortArrayList', // Dolibarr uses array()
82 82
 		// Fixers From PHPDocToRealTypesPlugin:
83
-		'PhanPluginCanUseParamType',			// Fixer - Report/Add types in the function definition (function abc(string $var) (adds string)
84
-		'PhanPluginCanUseReturnType',			// Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string)
85
-		'PhanPluginCanUseNullableParamType',	// Fixer - Report/Add nullable parameter types in the function definition
86
-		'PhanPluginCanUseNullableReturnType',	// Fixer - Report/Add nullable return types in the function definition
83
+		'PhanPluginCanUseParamType', // Fixer - Report/Add types in the function definition (function abc(string $var) (adds string)
84
+		'PhanPluginCanUseReturnType', // Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string)
85
+		'PhanPluginCanUseNullableParamType', // Fixer - Report/Add nullable parameter types in the function definition
86
+		'PhanPluginCanUseNullableReturnType', // Fixer - Report/Add nullable return types in the function definition
87 87
 
88
-		'PhanPluginNonBoolBranch',			// Not essential - 31240+ occurrences
89
-		'PhanPluginNumericalComparison',	// Not essential - 19870+ occurrences
90
-		'PhanTypeMismatchArgument',			// Not showing in cti.dolibarr until low count - Can detect missing array keys, invalid types, objects being passed when scalar expected - Not all reported by phpstan - <=1200 cases (was: 12300+ before)
91
-		'PhanPluginNonBoolInLogicalArith',	// Not essential - 11040+ occurrences
92
-		'PhanPluginConstantVariableScalar',	// Not essential - 5180+ occurrences
88
+		'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences
89
+		'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences
90
+		'PhanTypeMismatchArgument', // Not showing in cti.dolibarr until low count - Can detect missing array keys, invalid types, objects being passed when scalar expected - Not all reported by phpstan - <=1200 cases (was: 12300+ before)
91
+		'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences
92
+		'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences
93 93
 		'PhanPluginDuplicateAdjacentStatement',
94
-		'PhanPluginDuplicateConditionalTernaryDuplication',		// 2750+ occurrences
95
-		'PhanPluginDuplicateConditionalNullCoalescing',	// Not essential - 990+ occurrences
96
-		'PhanPluginRedundantAssignmentInGlobalScope',	// Not essential, a lot of false warning
97
-		'PhanPluginRedundantAssignment',				// Not essential, useless
98
-		'PhanPluginDuplicateCatchStatementBody',  // Requires PHP7.1 - 50+ occurrences
94
+		'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences
95
+		'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences
96
+		'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning
97
+		'PhanPluginRedundantAssignment', // Not essential, useless
98
+		'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences
99 99
 
100 100
 		// 'PhanPluginUnknownArrayMethodParamType',	// All fixed
101 101
 		// 'PhanPluginUnknownArrayMethodReturnType',	// All fixed
102
-		'PhanTypeSuspiciousNonTraversableForeach',  // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code.
102
+		'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code.
103 103
 ];
104 104
 
105 105
 return $config;
Please login to merge, or discard this patch.
htdocs/societe/class/api_thirdparties.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		$sql = "SELECT t.rowid";
157 157
 		$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
158
-		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields AS ef ON ef.fk_object = t.rowid";	// So we will be able to filter on extrafields
158
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields
159 159
 		if ($category > 0) {
160 160
 			if ($mode != 4) {
161 161
 				$sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) {
432 432
 			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
433 433
 		}
434
-		$this->company->oldcopy = clone $this->company;  // @phan-suppress-current-line PhanTypeMismatchProperty
434
+		$this->company->oldcopy = clone $this->company; // @phan-suppress-current-line PhanTypeMismatchProperty
435 435
 
436 436
 		$res = $this->company->delete($id);
437 437
 		if ($res < 0) {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 		}
481 481
 
482 482
 		if ($priceLevel < 1 || $priceLevel > getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT')) {
483
-			throw new RestException(400, 'Price level must be between 1 and ' . getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'));
483
+			throw new RestException(400, 'Price level must be between 1 and '.getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'));
484 484
 		}
485 485
 
486 486
 		if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) {
Please login to merge, or discard this patch.
htdocs/compta/facture/card.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 }
92 92
 
93 93
 // General $Variables
94
-$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid'));    // For backward compatibility
94
+$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility
95 95
 $ref = GETPOST('ref', 'alpha');
96 96
 $socid = GETPOSTINT('socid');
97 97
 $action = GETPOST('action', 'aZ09');
98 98
 $confirm = GETPOST('confirm', 'alpha');
99 99
 $cancel = GETPOST('cancel', 'alpha');
100
-$backtopage = GETPOST('backtopage', 'alpha');					// if not set, a default page will be used
101
-$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');	// if not set, $backtopage will be used
100
+$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
101
+$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
102 102
 $lineid = GETPOSTINT('lineid');
103 103
 $userid = GETPOSTINT('userid');
104 104
 $search_ref = GETPOST('sf_ref', 'alpha') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 					setEventMessages('', $warningMsgLineList, 'warnings');
268 268
 				}
269 269
 
270
-				header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result);
270
+				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result);
271 271
 				exit();
272 272
 			} else {
273 273
 				$langs->load("errors");
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 		// Validation
359 359
 		$object->fetch($id);
360 360
 
361
-		if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) &&	// empty should not happened, but when it occurs, the test save life
361
+		if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) && // empty should not happened, but when it occurs, the test save life
362 362
 			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')								// If option enabled, we force invoice date
363 363
 		) {
364 364
 			$object->date = dol_now();
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 			$error++;
1088 1088
 		}
1089 1089
 
1090
-		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver');	// If we enter the 02 january, we need to save the 02 january for server
1090
+		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
1091 1091
 		$date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver');
1092 1092
 
1093 1093
 		// Replacement invoice
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 				$object->note_private		= trim(GETPOST('note_private', 'restricthtml'));
1120 1120
 				$object->ref_client			= GETPOST('ref_client', 'alphanohtml');
1121 1121
 				$object->ref_customer		= GETPOST('ref_client', 'alphanohtml');
1122
-				$object->model_pdf          = GETPOST('model', 'alphanohtml');
1122
+				$object->model_pdf = GETPOST('model', 'alphanohtml');
1123 1123
 				$object->fk_project			= GETPOSTINT('projectid');
1124 1124
 				$object->cond_reglement_id	= GETPOSTINT('cond_reglement_id');
1125 1125
 				$object->mode_reglement_id	= GETPOSTINT('mode_reglement_id');
@@ -1180,9 +1180,9 @@  discard block
 block discarded – undo
1180 1180
 				$object->note_private		= trim(GETPOST('note_private', 'restricthtml'));
1181 1181
 				$object->ref_client			= GETPOST('ref_client', 'alphanohtml');
1182 1182
 				$object->ref_customer		= GETPOST('ref_client', 'alphanohtml');
1183
-				$object->model_pdf          = GETPOST('model');
1183
+				$object->model_pdf = GETPOST('model');
1184 1184
 				$object->fk_project			= GETPOSTINT('projectid');
1185
-				$object->cond_reglement_id	= 0;		// No payment term for a credit note
1185
+				$object->cond_reglement_id	= 0; // No payment term for a credit note
1186 1186
 				$object->mode_reglement_id	= GETPOSTINT('mode_reglement_id');
1187 1187
 				$object->fk_account         = GETPOSTINT('fk_account');
1188 1188
 				//$object->remise_absolue		= price2num(GETPOST('remise_absolue'), 'MU');
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
 				$object->note_public		= trim(GETPOST('note_public', 'restricthtml'));
1506 1506
 				$object->note_private       = trim(GETPOST('note_private', 'restricthtml'));
1507 1507
 				$object->ref_client			= GETPOST('ref_client');
1508
-				$object->ref_customer		= GETPOST('ref_client');
1508
+				$object->ref_customer = GETPOST('ref_client');
1509 1509
 				$object->model_pdf          = GETPOST('model');
1510 1510
 				$object->fk_project			= GETPOSTINT('projectid');
1511 1511
 				$object->cond_reglement_id	= (GETPOSTINT('type') == 3 ? 1 : GETPOST('cond_reglement_id'));
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
 						$element = $subelement = 'expedition';
1570 1570
 					}
1571 1571
 
1572
-					$object->origin = $origin;		// deprecated
1572
+					$object->origin = $origin; // deprecated
1573 1573
 					$object->origin_type = $origin;
1574 1574
 					$object->origin_id = $originid;
1575 1575
 
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
 						dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines or deposit lines");
1605 1605
 						$result = $srcobject->fetch($object->origin_id);
1606 1606
 
1607
-						$i = -1;  // Ensure initialised for static analysis, but with invalid idx.
1607
+						$i = -1; // Ensure initialised for static analysis, but with invalid idx.
1608 1608
 						// If deposit invoice - down payment with 1 line (fixed amount or percent)
1609 1609
 						if (GETPOST('type') == Facture::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) {
1610 1610
 							// Define the array $amountdeposit
@@ -2007,7 +2007,7 @@  discard block
 block discarded – undo
2007 2007
 				if (!empty($origin) && !empty($originid)) {
2008 2008
 					include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
2009 2009
 
2010
-					$object->origin = $origin;		// deprecated
2010
+					$object->origin = $origin; // deprecated
2011 2011
 					$object->origin_type = $origin;
2012 2012
 					$object->origin_id = $originid;
2013 2013
 
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
 						$line->fk_prev_id = $line->id;
2034 2034
 						$line->fetch_optionals();
2035 2035
 						if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
2036
-							$line->situation_percent = 0;  // New situation percent must be 0 (No cumulative)
2036
+							$line->situation_percent = 0; // New situation percent must be 0 (No cumulative)
2037 2037
 						} else {
2038 2038
 							$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
2039 2039
 						}
@@ -2150,7 +2150,7 @@  discard block
 block discarded – undo
2150 2150
 		} else {
2151 2151
 			$db->rollback();
2152 2152
 			$action = 'create';
2153
-			$_GET["origin"] = $_POST["origin"];		// Keep GET and POST here ?
2153
+			$_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ?
2154 2154
 			$_GET["originid"] = $_POST["originid"]; // Keep GET and POST here ?
2155 2155
 			setEventMessages($object->error, $object->errors, 'errors');
2156 2156
 		}
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 		// Define special_code for special lines
2709 2709
 		$special_code = GETPOSTINT('special_code');
2710 2710
 		if ($special_code == 3) {
2711
-			$special_code = 0;	// Options should not exists on invoices
2711
+			$special_code = 0; // Options should not exists on invoices
2712 2712
 		}
2713 2713
 
2714 2714
 		$line = new FactureLigne($db);
@@ -3272,7 +3272,7 @@  discard block
 block discarded – undo
3272 3272
 	$fk_account = GETPOSTINT('fk_account');
3273 3273
 
3274 3274
 	// Load objectsrc
3275
-	$objectsrc = null;  // Initialise
3275
+	$objectsrc = null; // Initialise
3276 3276
 	//$remise_absolue = 0;
3277 3277
 	if (!empty($origin) && !empty($originid)) {
3278 3278
 		// Parse element/subelement (ex: project_task)
@@ -3283,7 +3283,7 @@  discard block
 block discarded – undo
3283 3283
 			$subelement = $regs[2];
3284 3284
 		}
3285 3285
 
3286
-		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver');	// If we enter the 02 january, we need to save the 02 january for server
3286
+		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
3287 3287
 		$date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver');
3288 3288
 
3289 3289
 		if ($element == 'project') {
@@ -3361,8 +3361,8 @@  discard block
 block discarded – undo
3361 3361
 				$fk_account         = (!empty($expesrc->fk_account) ? $expesrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
3362 3362
 
3363 3363
 				if (isModEnabled('multicurrency')) {
3364
-					$currency_code 	= (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code));
3365
-					$currency_tx 	= (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx));
3364
+					$currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code));
3365
+					$currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx));
3366 3366
 				}
3367 3367
 
3368 3368
 				//Replicate extrafields
@@ -3455,7 +3455,7 @@  discard block
 block discarded – undo
3455 3455
 	print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST" id="formtocreate" name="formtocreate">';
3456 3456
 	print '<input type="hidden" name="token" value="'.newToken().'">';
3457 3457
 	print '<input type="hidden" name="action" id="formtocreateaction" value="add">';
3458
-	print '<input type="hidden" name="changecompany" value="0">';	// will be set to 1 by javascript so we know post is done after a company change
3458
+	print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change
3459 3459
 	if ($soc->id > 0) {
3460 3460
 		print '<input type="hidden" name="socid" value="'.$soc->id.'">'."\n";
3461 3461
 	}
@@ -3982,8 +3982,8 @@  discard block
 block discarded – undo
3982 3982
 		if ($socid > 0) {
3983 3983
 			print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td><td colspan="2">';
3984 3984
 
3985
-			$thirdparty = $soc;	// used by object_discounts.tpl.php
3986
-			$discount_type = 0;	// used by object_discounts.tpl.php
3985
+			$thirdparty = $soc; // used by object_discounts.tpl.php
3986
+			$discount_type = 0; // used by object_discounts.tpl.php
3987 3987
 			$backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid')));
3988 3988
 			include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
3989 3989
 
@@ -4024,7 +4024,7 @@  discard block
 block discarded – undo
4024 4024
 			if (empty($retained_warranty)) {
4025 4025
 				if ($objectsrc !== null && property_exists($objectsrc, 'retained_warranty') && !empty($objectsrc->retained_warranty)) { // use previous situation value
4026 4026
 					// Facture->retained_warranty  (does not exist on Expedition)
4027
-					$retained_warranty = $objectsrc->retained_warranty;  // @phan-suppress-current-line PhanUndeclaredProperty
4027
+					$retained_warranty = $objectsrc->retained_warranty; // @phan-suppress-current-line PhanUndeclaredProperty
4028 4028
 				}
4029 4029
 			}
4030 4030
 			$retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT');
@@ -4515,7 +4515,7 @@  discard block
 block discarded – undo
4515 4515
 		$nbMandated = 0;
4516 4516
 		foreach ($object->lines as $line) {
4517 4517
 			$res = $line->fetch_product();
4518
-			if ($res  > 0) {
4518
+			if ($res > 0) {
4519 4519
 				if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) {
4520 4520
 					$nbMandated++;
4521 4521
 					break;
@@ -4727,7 +4727,7 @@  discard block
 block discarded – undo
4727 4727
 	}
4728 4728
 	// Ref customer
4729 4729
 	$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string', '', 0, 1);
4730
-	$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
4730
+	$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
4731 4731
 	// Thirdparty
4732 4732
 	$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
4733 4733
 	if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
@@ -5016,7 +5016,7 @@  discard block
 block discarded – undo
5016 5016
 				print '<input type="hidden" name="token" value="'.newToken().'">';
5017 5017
 				$c = new Categorie($db);
5018 5018
 				$cats = $c->containing($object->id, Categorie::TYPE_INVOICE);
5019
-				$arrayselected=[];
5019
+				$arrayselected = [];
5020 5020
 				foreach ($cats as $cat) {
5021 5021
 					$arrayselected[] = $cat->id;
5022 5022
 				}
@@ -5153,45 +5153,45 @@  discard block
 block discarded – undo
5153 5153
 		}
5154 5154
 		print '<tr>';
5155 5155
 		// Amount HT
5156
-		print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
5157
-		print '<td class="nowrap amountcard right">' . price($sign * $object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
5156
+		print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
5157
+		print '<td class="nowrap amountcard right">'.price($sign * $object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
5158 5158
 		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
5159 5159
 			// Multicurrency Amount HT
5160
-			print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
5160
+			print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
5161 5161
 		}
5162 5162
 		print '</tr>';
5163 5163
 
5164 5164
 		print '<tr>';
5165 5165
 		// Amount VAT
5166
-		print '<td>' . $langs->trans('AmountVAT') . '</td>';
5167
-		print '<td class="nowrap amountcard right">' . price($sign * $object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
5166
+		print '<td>'.$langs->trans('AmountVAT').'</td>';
5167
+		print '<td class="nowrap amountcard right">'.price($sign * $object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
5168 5168
 		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
5169 5169
 			// Multicurrency Amount VAT
5170
-			print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
5170
+			print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
5171 5171
 		}
5172 5172
 		print '</tr>';
5173 5173
 
5174 5174
 		// Amount Local Taxes
5175 5175
 		if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {
5176 5176
 			print '<tr>';
5177
-			print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
5178
-			print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
5177
+			print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
5178
+			print '<td class="nowrap amountcard right">'.price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
5179 5179
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
5180 5180
 				$object->multicurrency_total_localtax1 = (float) price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');
5181 5181
 
5182
-				print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
5182
+				print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
5183 5183
 			}
5184 5184
 			print '</tr>';
5185 5185
 		}
5186 5186
 
5187 5187
 		if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {
5188 5188
 			print '<tr>';
5189
-			print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
5190
-			print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
5189
+			print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
5190
+			print '<td class="nowrap amountcard right">'.price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
5191 5191
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
5192 5192
 				$object->multicurrency_total_localtax2 = (float) price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');
5193 5193
 
5194
-				print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
5194
+				print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
5195 5195
 			}
5196 5196
 			print '</tr>';
5197 5197
 		}
@@ -5251,11 +5251,11 @@  discard block
 block discarded – undo
5251 5251
 
5252 5252
 		print '<tr>';
5253 5253
 		// Amount TTC
5254
-		print '<td>' . $langs->trans('AmountTTC') . '</td>';
5255
-		print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
5254
+		print '<td>'.$langs->trans('AmountTTC').'</td>';
5255
+		print '<td class="nowrap amountcard right">'.price($sign * $object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
5256 5256
 		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
5257 5257
 			// Multicurrency Amount TTC
5258
-			print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
5258
+			print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
5259 5259
 		}
5260 5260
 		print '</tr>';
5261 5261
 
@@ -5929,7 +5929,7 @@  discard block
 block discarded – undo
5929 5929
 					$langs->load("contracts");
5930 5930
 
5931 5931
 					if ($usercancreatecontract) {
5932
-						print '<a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a>';
5932
+						print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>';
5933 5933
 					}
5934 5934
 				}
5935 5935
 			}
@@ -6155,7 +6155,7 @@  discard block
 block discarded – undo
6155 6155
 			if ($usercandelete || ($usercancreate && $isErasable == 1)) {	// isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
6156 6156
 				$enableDelete = false;
6157 6157
 				$deleteHref = '#';
6158
-				if ($isErasable > 0 && ! $objectidnext) {
6158
+				if ($isErasable > 0 && !$objectidnext) {
6159 6159
 					$deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
6160 6160
 					$enableDelete = true;
6161 6161
 				}
Please login to merge, or discard this patch.
htdocs/product/class/product.class.php 2 patches
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	/**
151 151
 	 * @var string
152 152
 	 */
153
-	public $price_formated;			// used by takepos/ajax/ajax.php
153
+	public $price_formated; // used by takepos/ajax/ajax.php
154 154
 
155 155
 	/**
156 156
 	 * Selling price with tax
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	/**
163 163
 	 * @var string
164 164
 	 */
165
-	public $price_ttc_formated;		// used by takepos/ajax/ajax.php
165
+	public $price_ttc_formated; // used by takepos/ajax/ajax.php
166 166
 
167 167
 	/**
168 168
 	 * Minimum price net
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	/**
512 512
 	 * @var ?int
513 513
 	 */
514
-	public $weight_units;	// scale -3, 0, 3, 6
514
+	public $weight_units; // scale -3, 0, 3, 6
515 515
 	/**
516 516
 	 * @var float|string
517 517
 	 */
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	/**
520 520
 	 * @var ?int
521 521
 	 */
522
-	public $length_units;	// scale -3, 0, 3, 6
522
+	public $length_units; // scale -3, 0, 3, 6
523 523
 	/**
524 524
 	 * @var float|string
525 525
 	 */
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	/**
528 528
 	 * @var ?int
529 529
 	 */
530
-	public $width_units;	// scale -3, 0, 3, 6
530
+	public $width_units; // scale -3, 0, 3, 6
531 531
 	/**
532 532
 	 * @var float|string|null
533 533
 	 */
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @var ?int
537 537
 	 */
538
-	public $height_units;	// scale -3, 0, 3, 6
538
+	public $height_units; // scale -3, 0, 3, 6
539 539
 	/**
540 540
 	 * @var float|string|null
541 541
 	 */
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	/**
544 544
 	 * @var ?int
545 545
 	 */
546
-	public $surface_units;	// scale -3, 0, 3, 6
546
+	public $surface_units; // scale -3, 0, 3, 6
547 547
 	/**
548 548
 	 * @var float|string|null
549 549
 	 */
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	/**
552 552
 	 * @var ?int
553 553
 	 */
554
-	public $volume_units;	// scale -3, 0, 3, 6
554
+	public $volume_units; // scale -3, 0, 3, 6
555 555
 
556 556
 	/**
557 557
 	 * @var float|string|null
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	/**
561 561
 	 * @var ?int
562 562
 	 */
563
-	public $net_measure_units;	// scale -3, 0, 3, 6
563
+	public $net_measure_units; // scale -3, 0, 3, 6
564 564
 
565 565
 	/**
566 566
 	 * @var string
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 		'import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000),
876 876
 		//'tosell'       =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
877 877
 		//'tobuy'        =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
878
-		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1,  'notnull' => 1, 'default' => '0', 'index' => 1,  'position' => 1000),
878
+		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
879 879
 	);
880 880
 
881 881
 	/**
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 					$sql .= ", batch_mask";
1122 1122
 					$sql .= ", fk_unit";
1123 1123
 					$sql .= ", mandatory_period";
1124
-					if (!empty($this->default_vat_code)) $sql.=", default_vat_code";
1124
+					if (!empty($this->default_vat_code)) $sql .= ", default_vat_code";
1125 1125
 					$sql .= ") VALUES (";
1126 1126
 					$sql .= "'".$this->db->idate($this->date_creation)."'";
1127 1127
 					$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 					$sql .= ", '".$this->db->escape($this->batch_mask)."'";
1154 1154
 					$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
1155 1155
 					$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
1156
-					if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'";
1156
+					if (!empty($this->default_vat_code)) $sql .= ", '".$this->db->escape($this->default_vat_code)."'";
1157 1157
 					$sql .= ")";
1158 1158
 					dol_syslog(get_class($this)."::Create", LOG_DEBUG);
1159 1159
 
@@ -1180,9 +1180,9 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
 							// update accountancy for this entity
1182 1182
 							if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1183
-								$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1183
+								$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1184 1184
 
1185
-								$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1185
+								$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1186 1186
 								$sql .= " fk_product";
1187 1187
 								$sql .= ", entity";
1188 1188
 								$sql .= ", accountancy_code_buy";
@@ -1193,13 +1193,13 @@  discard block
 block discarded – undo
1193 1193
 								$sql .= ", accountancy_code_sell_export";
1194 1194
 								$sql .= ") VALUES (";
1195 1195
 								$sql .= $this->id;
1196
-								$sql .= ", " . ((int) $conf->entity);
1197
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1198
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1199
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1200
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1201
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1202
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1196
+								$sql .= ", ".((int) $conf->entity);
1197
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1198
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1199
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1200
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1201
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1202
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1203 1203
 								$sql .= ")";
1204 1204
 								$result = $this->db->query($sql);
1205 1205
 								if (!$result) {
@@ -1583,12 +1583,12 @@  discard block
 block discarded – undo
1583 1583
 			$sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null');
1584 1584
 			$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
1585 1585
 			if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1586
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1587
-				$sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1588
-				$sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1589
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1590
-				$sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1591
-				$sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1586
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1587
+				$sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1588
+				$sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
1589
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1590
+				$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1591
+				$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
1592 1592
 			}
1593 1593
 			$sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null");
1594 1594
 			$sql .= ", cost_price = ".($this->cost_price != '' ? ((float) $this->cost_price) : 'null');
@@ -1621,9 +1621,9 @@  discard block
 block discarded – undo
1621 1621
 
1622 1622
 				// update accountancy for this entity
1623 1623
 				if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1624
-					$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1624
+					$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1625 1625
 
1626
-					$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1626
+					$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1627 1627
 					$sql .= " fk_product";
1628 1628
 					$sql .= ", entity";
1629 1629
 					$sql .= ", accountancy_code_buy";
@@ -1634,13 +1634,13 @@  discard block
 block discarded – undo
1634 1634
 					$sql .= ", accountancy_code_sell_export";
1635 1635
 					$sql .= ") VALUES (";
1636 1636
 					$sql .= ((int) $this->id);
1637
-					$sql .= ", " . ((int) $conf->entity);
1638
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1639
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1640
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1641
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1642
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1643
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1637
+					$sql .= ", ".((int) $conf->entity);
1638
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1639
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1640
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1641
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1642
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1643
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1644 1644
 					$sql .= ")";
1645 1645
 					$result = $this->db->query($sql);
1646 1646
 					if (!$result) {
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
 								$error++;
1719 1719
 							} else {
1720 1720
 								// to keep old entries with the new dir
1721
-								require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
1721
+								require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
1722 1722
 								$ecmfiles = new EcmFiles($this->db);
1723 1723
 								$ecmfiles->updateAfterRename("produit/".dol_sanitizeFileName($this->oldcopy->ref), "produit/".dol_sanitizeFileName($this->ref));
1724 1724
 							}
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
 				}
2017 2017
 			} elseif (isset($this->multilangs[$key])) {
2018 2018
 				if (empty($this->multilangs[$key]["label"])) {
2019
-					$this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
2019
+					$this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
2020 2020
 					return -1;
2021 2021
 				}
2022 2022
 
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 	 */
2215 2215
 	private function getArrayForPriceCompare($level = 0)
2216 2216
 	{
2217
-		$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
2217
+		$testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly');
2218 2218
 
2219 2219
 		foreach ($testExit as $field) {
2220 2220
 			if (!isset($this->$field)) {
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
 							$price_base_type = $custprice_line->price_base_type;
2366 2366
 							$tva_tx = $custprice_line->tva_tx;
2367 2367
 							if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
2368
-								$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
2368
+								$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
2369 2369
 							}
2370 2370
 							$tva_npr = $custprice_line->recuperableonly;
2371 2371
 							if (empty($tva_tx)) {
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 							$price_base_type = $custprice_line->price_base_type;
2432 2432
 							$tva_tx = $custprice_line->tva_tx;
2433 2433
 							if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
2434
-								$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
2434
+								$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
2435 2435
 							}
2436 2436
 							$tva_npr = $custprice_line->recuperableonly;
2437 2437
 							if (empty($tva_tx)) {
@@ -2916,12 +2916,12 @@  discard block
 block discarded – undo
2916 2916
 
2917 2917
 		// For MultiCompany
2918 2918
 		// PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity
2919
-		$separatedEntityPMP = false;	// Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2920
-		$separatedStock = false;		// Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2919
+		$separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2920
+		$separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2921 2921
 		$visibleWarehousesEntities = $conf->entity;
2922 2922
 		if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
2923 2923
 			if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
2924
-				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2924
+				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2925 2925
 				if ($this->db->num_rows($checkPMPPerEntity) > 0) {
2926 2926
 					$separatedEntityPMP = true;
2927 2927
 				}
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
 			global $mc;
2930 2930
 			$separatedStock = true;
2931 2931
 			if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) {
2932
-				$visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']);
2932
+				$visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']);
2933 2933
 			}
2934 2934
 		}
2935 2935
 		if ($separatedEntityPMP) {
@@ -2947,10 +2947,10 @@  discard block
 block discarded – undo
2947 2947
 		}
2948 2948
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2949 2949
 		if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) {
2950
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
2950
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
2951 2951
 		}
2952 2952
 		if ($separatedStock) {
2953
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
2953
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
2954 2954
 		}
2955 2955
 
2956 2956
 		if ($id) {
@@ -3117,15 +3117,15 @@  discard block
 block discarded – undo
3117 3117
 						$sql .= " WHERE entity IN (".getEntity('productprice').")";
3118 3118
 						$sql .= " AND price_level=".((int) $i);
3119 3119
 						$sql .= " AND fk_product = ".((int) $this->id);
3120
-						$sql .= " ORDER BY date_price DESC, rowid DESC";	// Get the most recent line
3121
-						$sql .= " LIMIT 1";									// Only the first one
3120
+						$sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line
3121
+						$sql .= " LIMIT 1"; // Only the first one
3122 3122
 						$resql = $this->db->query($sql);
3123 3123
 						if ($resql) {
3124 3124
 							$result = $this->db->fetch_array($resql);
3125 3125
 
3126 3126
 							$this->multiprices[$i] = $result ? $result["price"] : null;
3127 3127
 							$this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null;
3128
-							$this->multiprices_min[$i] =  $result ? $result["price_min"] : null;
3128
+							$this->multiprices_min[$i] = $result ? $result["price_min"] : null;
3129 3129
 							$this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
3130 3130
 							$this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
3131 3131
 							// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
 				$obj = $this->db->fetch_object($result);
3351 3351
 				$this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0;
3352 3352
 				$this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0;
3353
-				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0;		// qty may be a float due to the SUM()
3353
+				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM()
3354 3354
 			} else {
3355 3355
 				$this->error = $this->db->error();
3356 3356
 				$error++;
@@ -4873,7 +4873,7 @@  discard block
 block discarded – undo
4873 4873
 				//Addition of a product with the highest rank +1
4874 4874
 				$sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)";
4875 4875
 				$sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".((int) $incdec).", ".((int) $rank).")";
4876
-				if (! $this->db->query($sql)) {
4876
+				if (!$this->db->query($sql)) {
4877 4877
 					dol_print_error($this->db);
4878 4878
 					return -1;
4879 4879
 				} else {
@@ -4994,7 +4994,7 @@  discard block
 block discarded – undo
4994 4994
 				$sql = "UPDATE ".$this->db->prefix()."product_association";
4995 4995
 				$sql .= " SET rang = ".((int) $cpt);
4996 4996
 				$sql .= " WHERE rowid = ".((int) $objrank->rowid);
4997
-				if (! $this->db->query($sql)) {
4997
+				if (!$this->db->query($sql)) {
4998 4998
 					dol_print_error($this->db);
4999 4999
 					return -1;
5000 5000
 				}
@@ -5434,7 +5434,7 @@  discard block
 block discarded – undo
5434 5434
 		if (isset($this->sousprods) && is_array($this->sousprods)) {
5435 5435
 			foreach ($this->sousprods as $prod_name => $desc_product) {
5436 5436
 				if (is_array($desc_product)) {
5437
-					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load);	// This set $this->res
5437
+					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res
5438 5438
 				}
5439 5439
 			}
5440 5440
 		}
@@ -5589,7 +5589,7 @@  discard block
 block discarded – undo
5589 5589
 		$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
5590 5590
 		$sql .= " ORDER BY pa.rang";
5591 5591
 
5592
-		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5592
+		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5593 5593
 
5594 5594
 		// Protection against infinite loop
5595 5595
 		if ($level > 30) {
@@ -5652,7 +5652,7 @@  discard block
 block discarded – undo
5652 5652
 			$parent[$this->label][$keyChild] = $valueChild;
5653 5653
 		}
5654 5654
 		foreach ($parent as $key => $value) {        // key=label, value is array of children
5655
-			$this->sousprods[$key] = $value;  // @phan-suppress-current-line PhanTypeMismatchProperty
5655
+			$this->sousprods[$key] = $value; // @phan-suppress-current-line PhanTypeMismatchProperty
5656 5656
 		}
5657 5657
 	}
5658 5658
 
@@ -5688,7 +5688,7 @@  discard block
 block discarded – undo
5688 5688
 		if (!empty($this->entity) && $permissiontoreadproduct) {
5689 5689
 			$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, '1');
5690 5690
 			if ($this->nbphoto > 0) {
5691
-				$datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>';
5691
+				$datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>';
5692 5692
 			}
5693 5693
 		}
5694 5694
 
@@ -5698,7 +5698,7 @@  discard block
 block discarded – undo
5698 5698
 			$datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>';
5699 5699
 		}
5700 5700
 		if (isset($this->status) && isset($this->status_buy)) {
5701
-			$datas['status'] = ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1);
5701
+			$datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1);
5702 5702
 		}
5703 5703
 
5704 5704
 		if (!empty($this->ref)) {
@@ -5748,7 +5748,7 @@  discard block
 block discarded – undo
5748 5748
 					$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
5749 5749
 				}
5750 5750
 				if ($labelsurfacevolume) {
5751
-					$datas['surface'] = "<br>" . $labelsurfacevolume;
5751
+					$datas['surface'] = "<br>".$labelsurfacevolume;
5752 5752
 				}
5753 5753
 			}
5754 5754
 			if ($this->isService() && !empty($this->duration_value)) {
@@ -5790,9 +5790,9 @@  discard block
 block discarded – undo
5790 5790
 			}
5791 5791
 			// show categories for this record only in ajax to not overload lists
5792 5792
 			if (isModEnabled('category') && !$nofetch) {
5793
-				require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5793
+				require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5794 5794
 				$form = new Form($this->db);
5795
-				$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5795
+				$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5796 5796
 			}
5797 5797
 		}
5798 5798
 
@@ -6320,7 +6320,7 @@  discard block
 block discarded – undo
6320 6320
 		if (isModEnabled("supplier_order")) {
6321 6321
 			$filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4');
6322 6322
 			if (isset($includedraftpoforvirtual)) {
6323
-				$filterStatus = '0,1,2,'.$filterStatus;	// 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
6323
+				$filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
6324 6324
 			}
6325 6325
 			$result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock);
6326 6326
 			if ($result < 0) {
@@ -6361,7 +6361,7 @@  discard block
 block discarded – undo
6361 6361
 		} elseif (getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER')) {
6362 6362
 			if (getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER_INCLUDE_DRAFT')) {	// By default, draft means "does not exist", so we do not include them by default, except if option is on
6363 6363
 				$tmpnewprod = dol_clone($this, 1);
6364
-				$result = $tmpnewprod->load_stats_commande(0, '0', 1);	// Get qty in draft orders
6364
+				$result = $tmpnewprod->load_stats_commande(0, '0', 1); // Get qty in draft orders
6365 6365
 				$this->stock_theorique += $tmpnewprod->stats_commande['qty'];
6366 6366
 			}
6367 6367
 		} elseif (getDolGlobalString('STOCK_CALCULATE_ON_BILL') && $weBillOrderOrShipmentReception == 'order') {
@@ -6378,7 +6378,7 @@  discard block
 block discarded – undo
6378 6378
 		} elseif (getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER')) {	// Warning: stock change "on approval", not on validation !
6379 6379
 			if (getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER_INCLUDE_DRAFT')) {	// By default, draft means "does not exist", so we do not include them by default, except if option is on
6380 6380
 				$tmpnewprod = dol_clone($this, 1);
6381
-				$result = $tmpnewprod->load_stats_commande_fournisseur(0, '0', 1);	// Get qty in draft orders
6381
+				$result = $tmpnewprod->load_stats_commande_fournisseur(0, '0', 1); // Get qty in draft orders
6382 6382
 				$this->stock_theorique += $this->stats_commande_fournisseur['qty'];
6383 6383
 			}
6384 6384
 			$this->stock_theorique -= $stock_reception_fournisseur;
@@ -6755,7 +6755,7 @@  discard block
 block discarded – undo
6755 6755
 		if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
6756 6756
 			$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
6757 6757
 			foreach ($dirsociete as $dirroot) {
6758
-				$res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6758
+				$res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6759 6759
 				if ($res) {
6760 6760
 					break;
6761 6761
 				}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1121,7 +1121,9 @@  discard block
 block discarded – undo
1121 1121
 					$sql .= ", batch_mask";
1122 1122
 					$sql .= ", fk_unit";
1123 1123
 					$sql .= ", mandatory_period";
1124
-					if (!empty($this->default_vat_code)) $sql.=", default_vat_code";
1124
+					if (!empty($this->default_vat_code)) {
1125
+						$sql.=", default_vat_code";
1126
+					}
1125 1127
 					$sql .= ") VALUES (";
1126 1128
 					$sql .= "'".$this->db->idate($this->date_creation)."'";
1127 1129
 					$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
@@ -1153,7 +1155,9 @@  discard block
 block discarded – undo
1153 1155
 					$sql .= ", '".$this->db->escape($this->batch_mask)."'";
1154 1156
 					$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
1155 1157
 					$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
1156
-					if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'";
1158
+					if (!empty($this->default_vat_code)) {
1159
+						$sql.=", '".$this->db->escape($this->default_vat_code)."'";
1160
+					}
1157 1161
 					$sql .= ")";
1158 1162
 					dol_syslog(get_class($this)."::Create", LOG_DEBUG);
1159 1163
 
Please login to merge, or discard this patch.
htdocs/variants/class/ProductCombination.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 					$new_price += $this->variation_price;
607 607
 				}
608 608
 
609
-				$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq,0, array(), $parent->default_vat_code);
609
+				$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
610 610
 
611 611
 				if ($ret < 0) {
612 612
 					$this->db->rollback();
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 			 * @param mixed $v Feature information of a product.
650 650
 			 * @return bool
651 651
 			 */
652
-			static function ($v) {
652
+			static function($v) {
653 653
 				return !empty($v);
654 654
 			}
655 655
 		);
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
 			if ($forced_refvar === false) {
858 858
 				if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
859
-					$newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR') . $prodattrval->ref;
859
+					$newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR').$prodattrval->ref;
860 860
 				} else {
861 861
 					$newproduct->ref .= '_'.$prodattrval->ref;
862 862
 				}
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 				$productCombinationLevel->fk_price_level = $i;
884 884
 				$productCombinationLevel->variation_price = $price_impact[$i];
885 885
 
886
-				$productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ;
886
+				$productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i];
887 887
 
888 888
 				$newcomb->combination_price_levels[$i] = $productCombinationLevel;
889 889
 			}
@@ -997,8 +997,8 @@  discard block
 block discarded – undo
997 997
 			$variation_price = $combinationObject->variation_price;
998 998
 
999 999
 			if (getDolGlobalInt('PRODUIT_MULTIPRICES') && getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT') > 1) {
1000
-				$variation_price_percentage = [ ];
1001
-				$variation_price = [ ];
1000
+				$variation_price_percentage = [];
1001
+				$variation_price = [];
1002 1002
 
1003 1003
 				foreach ($combinationObject->combination_price_levels as $productCombinationLevel) {
1004 1004
 					$variation_price_percentage[$productCombinationLevel->fk_price_level] = $productCombinationLevel->variation_price_percentage;
Please login to merge, or discard this patch.
htdocs/admin/remotestore/class/externalModules.class.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 			$httpheader[] = 'Authorization: Basic '.base64_encode($basicAuthLogin.':'.$basicAuthPassword);
189 189
 		}
190 190
 
191
-		$url = $this->dolistore_api_url . (preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/') . $resource;
191
+		$url = $this->dolistore_api_url.(preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/').$resource;
192 192
 
193 193
 		$options['apikey'] = $this->dolistore_api_key;
194 194
 
195 195
 		if ($options) {
196
-			$url .= '?' . http_build_query($options);
196
+			$url .= '?'.http_build_query($options);
197 197
 		}
198 198
 
199 199
 		$url .= (preg_match('/\?/', $url) ? '&' : '?').'apikey='.$this->dolistore_api_key;
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		$modules = array();
222 222
 
223 223
 		if (!empty($this->cache_file) && file_exists($this->cache_file)) {
224
-			dol_syslog(__METHOD__ . " - Loading cache file: " . $this->cache_file, LOG_DEBUG);
224
+			dol_syslog(__METHOD__." - Loading cache file: ".$this->cache_file, LOG_DEBUG);
225 225
 
226 226
 			$content = file_get_contents($this->cache_file);
227 227
 			if ($content !== false) {
228 228
 				$modules = $this->readYaml($content);
229 229
 			} else {
230
-				dol_syslog(__METHOD__ . " - Error reading cache file", LOG_ERR);
230
+				dol_syslog(__METHOD__." - Error reading cache file", LOG_ERR);
231 231
 			}
232 232
 		}
233 233
 
@@ -252,20 +252,20 @@  discard block
 block discarded – undo
252 252
 		if (isset($resCategories['response']) && is_array($resCategories['response'])) {
253 253
 			$organized_tree = $resCategories['response'];
254 254
 		} else {
255
-			return $html ;
255
+			return $html;
256 256
 		}
257 257
 
258 258
 		$html = '';
259 259
 		foreach ($organized_tree as $key => $value) {
260 260
 			if ($value['label'] != "Versions" && $value['label'] != "Specials") {
261 261
 				$html .= '<li>';
262
-				$html .= '<a href="?mode=marketplace&categorie=' . $value['rowid'] . '">' . $value['label'] . '</a>';
262
+				$html .= '<a href="?mode=marketplace&categorie='.$value['rowid'].'">'.$value['label'].'</a>';
263 263
 				if (isset($value['children'])) {
264 264
 					$html .= '<ul>';
265 265
 					usort($value['children'], $this->buildSorter('position'));
266 266
 					foreach ($value['children'] as $key_children => $value_children) {
267 267
 						$html .= '<li>';
268
-						$html .= '<a href="?mode=marketplace&categorie=' . $value_children['rowid'] . '" title="' . dol_escape_htmltag(strip_tags($value_children['description'])) . '">' . $value_children['label'] . '</a>';
268
+						$html .= '<a href="?mode=marketplace&categorie='.$value_children['rowid'].'" title="'.dol_escape_htmltag(strip_tags($value_children['description'])).'">'.$value_children['label'].'</a>';
269 269
 						$html .= '</li>';
270 270
 					}
271 271
 					$html .= '</ul>';
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 
288 288
 		$html       = "";
289 289
 		$last_month = dol_now() - (30 * 24 * 60 * 60);
290
-		$dolibarrversiontouse = DOL_VERSION;	// full string with version
290
+		$dolibarrversiontouse = DOL_VERSION; // full string with version
291 291
 
292 292
 		$this->products = array();
293 293
 
294 294
 		$this->categorie = $options['categorie'] ?? 0;
295 295
 		$this->per_page  = $options['per_page'] ?? 11;
296
-		$this->no_page  = $options['no_page'] ?? 1;
296
+		$this->no_page = $options['no_page'] ?? 1;
297 297
 		$this->search    = $options['search'] ?? '';
298 298
 
299 299
 		$data = [
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		// fetch from github repo
320 320
 		$fileProducts = array();
321 321
 		if (!empty($this->githubFileStatus) && getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY')) {
322
-			$fileProducts = $this->fetchModulesFromFile($data);			// Return an array with all modules from the cache filecontent in $data
322
+			$fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data
323 323
 
324 324
 			$fileProducts = $this->adaptData($fileProducts, 'githubcommunity');
325 325
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			 * @param array<string, mixed> $b Second product for comparison.
340 340
 			 * @return int
341 341
 			 */
342
-			static function ($a, $b) {
342
+			static function($a, $b) {
343 343
 				return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0');
344 344
 			}
345 345
 		);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 				if ($product['source'] === 'githubcommunity') {
379 379
 					$download_link = '<a class="paddingleft paddingright" target="_blank" href="'.$product["link"].'"><img width="32" src="'.DOL_URL_ROOT.'/admin/remotestore/img/follow.png" /></a>';
380 380
 					if (!empty($product['direct-download']) && $product['direct-download'] == 'yes') {
381
-						$urldownload = $product["dolistore-download"];		// In a future, we will have the download to the zip file
381
+						$urldownload = $product["dolistore-download"]; // In a future, we will have the download to the zip file
382 382
 						$reg = array();
383 383
 						if (preg_match('/https:.*\?id=(\d+)$/', $urldownload, $reg)) {
384 384
 							$urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p='.$reg[1];
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
 			//output template
432 432
 			$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">';
433 433
 			$html .= '<td class="center" width="160"><div class="newAppParent">';
434
-			$html .= $newapp.$images;	// No dol_escape_htmltag, it is already escape html
434
+			$html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html
435 435
 			$html .= '</div></td>';
436 436
 			$html .= '<td class="margeCote"><h2 class="appTitle">';
437 437
 			$html .= dol_escape_htmltag(dol_string_nohtmltag($product["label"]));
438 438
 			$html .= '<br><small>';
439
-			$html .= $version;			// No dol_escape_htmltag, it is already escape html
439
+			$html .= $version; // No dol_escape_htmltag, it is already escape html
440 440
 			$html .= '</small></h2>';
441 441
 			$html .= '<small> ';
442 442
 			if (empty($product['tms'])) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 
479
-		return $html ;
479
+		return $html;
480 480
 	}
481 481
 
482 482
 	/**
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 		 * @param array<string, mixed> $b
494 494
 		 * @return int
495 495
 		 */
496
-		function (array $a, array $b) use ($key) {
496
+		function(array $a, array $b) use ($key) {
497 497
 			$valA = isset($a[$key]) && is_scalar($a[$key]) ? (string) $a[$key] : '';
498 498
 			$valB = isset($b[$key]) && is_scalar($b[$key]) ? (string) $b[$key] : '';
499 499
 
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 		}
636 636
 
637 637
 		// Get the predefined error message or use a default one
638
-		$error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: ' . $request['status_code'];
638
+		$error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: '.$request['status_code'];
639 639
 
640 640
 		// Append error details if available
641 641
 		if (!empty($request['response']) && isset($request['response']['errors']) && is_array($request['response']['errors'])) {
642 642
 			foreach ($request['response']['errors'] as $error) {
643
-				$error_message .= ' - (Code ' . $error['code'] . '): ' . $error['message'];
643
+				$error_message .= ' - (Code '.$error['code'].'): '.$error['message'];
644 644
 			}
645 645
 		}
646 646
 
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 			 *
867 867
 			 * @return int
868 868
 			 */
869
-			static function ($a, $b) {
869
+			static function($a, $b) {
870 870
 				return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0');
871 871
 			}
872 872
 		);
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 				 *
882 882
 				 * @return bool
883 883
 				 */
884
-				static function ($package) use ($options) {
884
+				static function($package) use ($options) {
885 885
 					return stripos($package['label'], $options['search']) !== false || stripos($package['description'], $options['search']) !== false;
886 886
 				}
887 887
 			);
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 				 *
898 898
 				 * @return bool
899 899
 				 */
900
-				static function ($package) use ($options) {
900
+				static function($package) use ($options) {
901 901
 					return in_array($options['categorieid'], $package['category']);
902 902
 				}
903 903
 			);
Please login to merge, or discard this patch.
htdocs/admin/modules.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 $options['categorie'] 		= ((int) (GETPOSTINT('categorie') ? GETPOSTINT('categorie') : 0));
88 88
 $options['search']    		= GETPOST('search_keyword', 'alpha');
89 89
 
90
-$options['search_source_dolistore']	= getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_DOLISTORE');
91
-$options['search_source_github']	= getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY');
90
+$options['search_source_dolistore'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_DOLISTORE');
91
+$options['search_source_github'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY');
92 92
 
93 93
 //$remotestore = new Dolistore(false);
94 94
 $remotestore = new ExternalModules();
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 				//var_dump($modulenamearrays);exit;
318 318
 
319 319
 				// Lop on each packages (can have several if package is a metapackage)
320
-				if (! $error) {
320
+				if (!$error) {
321 321
 					foreach ($modulenamearrays as $modulenameval) {
322 322
 						if (strpos($modulenameval, '#') === 0) {
323 323
 							continue; // Discard comments
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 			'search_version' => '-1'
387 387
 		);
388 388
 		$queryString = http_build_query($searchParams);
389
-		$redirectUrl = DOL_URL_ROOT . '/admin/modules.php?' . $queryString;
389
+		$redirectUrl = DOL_URL_ROOT.'/admin/modules.php?'.$queryString;
390 390
 
391 391
 		$message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules"));
392 392
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 								} else {
588 588
 									$familykey = $objMod->family;
589 589
 								}
590
-								'@phan-var-force string $familykey';  // if not, phan considers $familykey may be null
590
+								'@phan-var-force string $familykey'; // if not, phan considers $familykey may be null
591 591
 
592 592
 								$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
593 593
 								if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) {
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
694 694
 
695 695
 // Start to show page
696
-$deschelp  = '';
696
+$deschelp = '';
697 697
 if ($mode == 'common' || $mode == 'commonkanban') {
698 698
 	$desc = $langs->trans("ModulesDesc", '{picto}');
699 699
 	$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 		}
981 981
 
982 982
 		if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) {
983
-			$checkRes = $objMod->checkForCompliance();	// Check if module is reported as non compliant with Dolibarr rules and law
983
+			$checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law
984 984
 			if (!is_numeric($checkRes) && $checkRes != '') {
985 985
 				$langs->load("errors");
986 986
 				setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors');
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 
1329 1329
 		print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1330 1330
 
1331
-		$categories_tree = $remotestore->getCategories();		// Call API to get the categories
1331
+		$categories_tree = $remotestore->getCategories(); // Call API to get the categories
1332 1332
 
1333 1333
 		$products_list = $remotestore->getProducts($options);
1334 1334
 
Please login to merge, or discard this patch.