Completed
Branch develop (f4109d)
by
unknown
21:59
created
htdocs/takepos/invoice.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 
173 173
 $parameters = array();
174
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
174
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
175 175
 if ($reshook < 0) {
176 176
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
177 177
 }
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 			$bankaccount = GETPOSTINT('accountid');
187 187
 		} else {
188 188
 			if ($pay == 'LIQ') {
189
-				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]);            // For backward compatibility
189
+				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility
190 190
 			} elseif ($pay == "CHQ") {
191
-				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]);    // For backward compatibility
191
+				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility
192 192
 			} else {
193 193
 				$accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"];
194 194
 				$bankaccount = getDolGlobalInt($accountname);
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 			// The case for isModEnabled('productbatch') is processed few lines later.
255 255
 			$savconst = getDolGlobalString('STOCK_CALCULATE_ON_BILL');
256 256
 
257
-			$conf->global->STOCK_CALCULATE_ON_BILL = 1;	// To force the change of stock during invoice validation
257
+			$conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock during invoice validation
258 258
 
259 259
 			$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
260 260
 			dol_syslog("Validate invoice with stock change. Warehouse defined into constant ".$constantforkey." = ".getDolGlobalString($constantforkey));
261 261
 
262 262
 			// Validate invoice with stock change into warehouse getDolGlobalInt($constantforkey)
263 263
 			// Label of stock movement will be the same as when we validate invoice "Invoice XXXX validated"
264
-			$batch_rule = 0;	// Module productbatch is disabled here, so no need for a batch_rule.
264
+			$batch_rule = 0; // Module productbatch is disabled here, so no need for a batch_rule.
265 265
 			$res = $invoice->validate($user, '', getDolGlobalInt($constantforkey), 0, $batch_rule);
266 266
 
267 267
 			// Restore setup
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 				dol_syslog("Now we record the stock movement for each qualified line");
333 333
 
334 334
 				// The case !isModEnabled('productbatch') was processed few lines before.
335
-				require_once DOL_DOCUMENT_ROOT . "/product/stock/class/mouvementstock.class.php";
335
+				require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
336 336
 				$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
337 337
 				$inventorycode = dol_print_date(dol_now(), 'dayhourlog');
338 338
 				// Label of stock movement will be "TakePOS - Invoice XXXX"
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		$creditnote->socid = $invoice->socid;
383 383
 		$creditnote->date = dol_now();
384 384
 		$creditnote->module_source = 'takepos';
385
-		$creditnote->pos_source =  isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
385
+		$creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '';
386 386
 		$creditnote->type = Facture::TYPE_CREDIT_NOTE;
387 387
 		$creditnote->fk_facture_source = $placeid;
388 388
 		//$creditnote->remise_absolue = $invoice->remise_absolue;
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			// If module stock is enabled and we do not setup takepo to disable stock decrease
510 510
 			// The case for isModEnabled('productbatch') is processed few lines later.
511 511
 			$savconst = getDolGlobalString('STOCK_CALCULATE_ON_BILL');
512
-			$conf->global->STOCK_CALCULATE_ON_BILL = 1;	// We force setup to have update of stock on invoice validation/unvalidation
512
+			$conf->global->STOCK_CALCULATE_ON_BILL = 1; // We force setup to have update of stock on invoice validation/unvalidation
513 513
 
514 514
 			$constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
515 515
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 
518 518
 			// Validate invoice with stock change into warehouse getDolGlobalInt($constantforkey)
519 519
 			// Label of stock movement will be the same as when we validate invoice "Invoice XXXX validated"
520
-			$batch_rule = 0;	// Module productbatch is disabled here, so no need for a batch_rule.
520
+			$batch_rule = 0; // Module productbatch is disabled here, so no need for a batch_rule.
521 521
 			$res = $creditnote->validate($user, '', getDolGlobalString($constantforkey), 0, $batch_rule);
522 522
 			if ($res < 0) {
523 523
 				$error++;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 				dol_syslog("Now we record the stock movement for each qualified line");
538 538
 
539 539
 				// The case !isModEnabled('productbatch') was processed few lines before.
540
-				require_once DOL_DOCUMENT_ROOT . "/product/stock/class/mouvementstock.class.php";
540
+				require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
541 541
 				$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
542 542
 				$inventorycode = dol_print_date(dol_now(), 'dayhourlog');
543 543
 				// Label of stock movement will be "TakePOS - Invoice XXXX"
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 		if (!$error && $res >= 0) {
578 578
 			$db->commit();
579 579
 		} else {
580
-			$creditnote->id = $placeid;	// Creation has failed, we reset to ID of source invoice so we go back to this one in action=history
580
+			$creditnote->id = $placeid; // Creation has failed, we reset to ID of source invoice so we go back to this one in action=history
581 581
 			$db->rollback();
582 582
 		}
583 583
 	}
@@ -598,10 +598,10 @@  discard block
 block discarded – undo
598 598
 		$invoice->socid = getDolGlobalInt($constforcompanyid);
599 599
 
600 600
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
601
-		$invoice->date = dol_get_first_hour(dol_now('tzuserrel'));		// Invoice::create() needs a date with no hours
601
+		$invoice->date = dol_get_first_hour(dol_now('tzuserrel')); // Invoice::create() needs a date with no hours
602 602
 
603 603
 		$invoice->module_source = 'takepos';
604
-		$invoice->pos_source =  isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
604
+		$invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '';
605 605
 		$invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity;
606 606
 
607 607
 		if ($invoice->socid <= 0) {
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 
812 812
 			// complete line by hook
813 813
 			$parameters = array('prod' => $prod, 'line' => $line);
814
-			$reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action);    // Note that $action and $line may have been modified by some hooks
814
+			$reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks
815 815
 			if ($reshook < 0) {
816 816
 				setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
817 817
 			}
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 					}
1015 1015
 					if (!$permissiontoupdateline) {
1016 1016
 						dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateprice', null, 1);
1017
-					} elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')  == 1) {
1017
+					} elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) {
1018 1018
 						$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
1019 1019
 					} else {
1020 1020
 						$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 	if ($action == "setbatch" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) {
1080 1080
 		$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
1081
-		$warehouseid = (GETPOSTINT('warehouseid') > 0 ? GETPOSTINT('warehouseid') : getDolGlobalInt($constantforkey));	// Get the warehouse id from GETPOSTINT('warehouseid'), otherwise use default setup.
1081
+		$warehouseid = (GETPOSTINT('warehouseid') > 0 ? GETPOSTINT('warehouseid') : getDolGlobalInt($constantforkey)); // Get the warehouse id from GETPOSTINT('warehouseid'), otherwise use default setup.
1082 1082
 		$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET batch = '".$db->escape($batch)."', fk_warehouse = ".((int) $warehouseid);
1083 1083
 		$sql .= " WHERE rowid=".((int) $idoflineadded);
1084 1084
 		$db->query($sql);
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 
1227 1227
 		$sectionwithinvoicelink .= '</span><br>';
1228 1228
 		if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
1229
-			$sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>';
1229
+			$sectionwithinvoicelink .= ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>';
1230 1230
 		} elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
1231 1231
 			if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
1232 1232
 				$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
 if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
1266 1266
 	$title = 'TakePOS - Dolibarr '.DOL_VERSION;
1267 1267
 	if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
1268
-		$title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE');
1268
+		$title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE');
1269 1269
 	}
1270 1270
 	$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
1271 1271
 	<meta name="apple-mobile-web-app-capable" content="yes">
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 			if ($contactid > 0) {
1493 1493
 				$contact = new Contact($db);
1494 1494
 				$contact->fetch($contactid);
1495
-				$s .= " - " . $contact->getFullName($langs);
1495
+				$s .= " - ".$contact->getFullName($langs);
1496 1496
 			}
1497 1497
 		}
1498 1498
 	}
@@ -1553,10 +1553,10 @@  discard block
 block discarded – undo
1553 1553
 	$s = '';
1554 1554
 
1555 1555
 	$idwarehouse = 0;
1556
-	$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1556
+	$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1557 1557
 	if (isModEnabled('stock')) {
1558 1558
 		if (getDolGlobalString($constantforkey) != "1") {
1559
-			$constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1559
+			$constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1560 1560
 			$idwarehouse = getDolGlobalString($constantforkey);
1561 1561
 			if ($idwarehouse > 0) {
1562 1562
 				$s = '<span class="small">';
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 
1705 1705
 // Complete header by hook
1706 1706
 $parameters = array();
1707
-$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1707
+$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
1708 1708
 if ($reshook < 0) {
1709 1709
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1710 1710
 }
@@ -1718,16 +1718,16 @@  discard block
 block discarded – undo
1718 1718
 	print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
1719 1719
 	if (getDolGlobalString('TAKEPOS_SHOW_HT')) {
1720 1720
 		print '<td class="linecolht right nowraponall">';
1721
-		print '<span class="opacitymedium small">' . $langs->trans('TotalHTShort') . '</span><br>';
1721
+		print '<span class="opacitymedium small">'.$langs->trans('TotalHTShort').'</span><br>';
1722 1722
 		// In phone version only show when it is invoice page
1723 1723
 		if (empty($mobilepage) || $mobilepage == "invoice") {
1724
-			print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</span>';
1724
+			print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">'.price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency).'</span>';
1725 1725
 			if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
1726 1726
 				//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
1727
-				include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php';
1727
+				include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
1728 1728
 				$multicurrency = new MultiCurrency($db);
1729 1729
 				$multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]);
1730
-				print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">(' . price($invoice->total_ht * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>';
1730
+				print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($invoice->total_ht * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>';
1731 1731
 			}
1732 1732
 		}
1733 1733
 		print '</td>';
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
 
1872 1872
 				// complete line by hook
1873 1873
 				$parameters = array('line' => $line);
1874
-				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1874
+				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
1875 1875
 				if ($reshook < 0) {
1876 1876
 					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1877 1877
 				}
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 					}
1927 1927
 				}
1928 1928
 				if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) {
1929
-					$htmlforlines .= $form->textwithpicto($line->product_label ? '<b>' . $line->product_ref . '</b> - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext);
1929
+					$htmlforlines .= $form->textwithpicto($line->product_label ? '<b>'.$line->product_ref.'</b> - '.$line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext);
1930 1930
 				} elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) {
1931 1931
 					$htmlforlines .= $form->textwithpicto($line->product_ref ? '<b>'.$line->product_ref.'<b>' : dolGetFirstLineOfText($line->desc, 1), $tooltiptext);
1932 1932
 				} else {
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 
1985 1985
 				// complete line by hook
1986 1986
 				$parameters = array('line' => $line);
1987
-				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1987
+				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
1988 1988
 				if ($reshook < 0) {
1989 1989
 					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1990 1990
 				}
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && !getDolGlobalString('TAKEPOS_NO_CREDITNOTE')) {
2096 2096
 	print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>';
2097 2097
 	if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
2098
-		print ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>';
2098
+		print ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>';
2099 2099
 	}
2100 2100
 }
2101 2101
 
Please login to merge, or discard this patch.
htdocs/compta/facture/class/facture.class.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			$this->mode_reglement_id = 0;
504 504
 		}
505 505
 		$this->status = self::STATUS_DRAFT;
506
-		$this->statut = self::STATUS_DRAFT;	// deprecated
506
+		$this->statut = self::STATUS_DRAFT; // deprecated
507 507
 
508 508
 		if (!empty($this->multicurrency_code)) {
509 509
 			// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 			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.
575 575
 				$this->socid = $_facrec->socid;
576 576
 			}
577
-			$this->entity            = $_facrec->entity; // Invoice created in same entity than template
577
+			$this->entity = $_facrec->entity; // Invoice created in same entity than template
578 578
 
579 579
 			// Fields coming from GUI.
580 580
 			// @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
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 				$this->mode_reglement_id = 0;
614 614
 			}
615 615
 			$this->status = self::STATUS_DRAFT;
616
-			$this->statut = self::STATUS_DRAFT;	// deprecated
616
+			$this->statut = self::STATUS_DRAFT; // deprecated
617 617
 
618 618
 			$this->linked_objects = $_facrec->linkedObjectsIds;
619 619
 			// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 						// Complete vat rate with code
861 861
 						$vatrate = $newinvoiceline->tva_tx;
862
-						if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
862
+						if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) {
863 863
 							$vatrate .= ' ('.$newinvoiceline->vat_src_code.')';
864 864
 						}
865 865
 
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 						($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) ? $previousdaynextdatewhen : '',
1080 1080
 						0,
1081 1081
 						$tva_npr,
1082
-						0,  // fk_remise_except
1082
+						0, // fk_remise_except
1083 1083
 						'HT',
1084 1084
 						0,
1085 1085
 						$_facrec->lines[$i]->product_type,
@@ -1092,8 +1092,8 @@  discard block
 block discarded – undo
1092 1092
 						$buyprice,
1093 1093
 						$_facrec->lines[$i]->label,
1094 1094
 						empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options,
1095
-						100,	// situation percent is undefined on recurring invoice lines
1096
-						0,  // fk_prev_id
1095
+						100, // situation percent is undefined on recurring invoice lines
1096
+						0, // fk_prev_id
1097 1097
 						$_facrec->lines[$i]->fk_unit,
1098 1098
 						$_facrec->lines[$i]->multicurrency_subprice,
1099 1099
 						$_facrec->lines[$i]->ref_ext,
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 
1186 1186
 		$facture->fk_facture_source = $this->fk_facture_source;
1187 1187
 		$facture->type 			    = $this->type;
1188
-		$facture->subtype 			= $this->subtype;
1188
+		$facture->subtype = $this->subtype;
1189 1189
 		$facture->socid 		    = $this->socid;
1190 1190
 		$facture->date              = $this->date;
1191 1191
 		$facture->date_pointoftax   = $this->date_pointoftax;
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
 		$facture->origin            = $this->origin;
1204 1204
 		$facture->origin_id         = $this->origin_id;
1205
-		$facture->fk_account         = $this->fk_account;
1205
+		$facture->fk_account = $this->fk_account;
1206 1206
 
1207 1207
 		$facture->lines = $this->lines; // Array of lines of invoice
1208 1208
 		$facture->situation_counter = $this->situation_counter;
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 	{
1677 1677
 		global $conf, $langs, $hookmanager, $action;
1678 1678
 
1679
-		if (! in_array($origin->element, array('propal', 'commande'))) {
1679
+		if (!in_array($origin->element, array('propal', 'commande'))) {
1680 1680
 			$origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder';
1681 1681
 			return null;
1682 1682
 		}
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
 			return null;
1687 1687
 		}
1688 1688
 
1689
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
1689
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
1690 1690
 
1691 1691
 		if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + getDolGlobalInt('INVOICE_MAX_FUTURE_DELAY'))) {
1692 1692
 			$origin->error = 'ErrorDateIsInFuture';
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 		$deposit->pos_source = $origin->pos_source;
1731 1731
 		$deposit->model_pdf = 'crabe';
1732 1732
 
1733
-		$modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type;
1733
+		$modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type;
1734 1734
 
1735 1735
 		if (getDolGlobalString($modelByTypeConfName)) {
1736 1736
 			$deposit->model_pdf = getDolGlobalString($modelByTypeConfName);
@@ -1790,10 +1790,10 @@  discard block
 block discarded – undo
1790 1790
 					$descriptions[$key] = '';
1791 1791
 				}
1792 1792
 				$TTotalByTva[$key] += $line->total_ttc;
1793
-				$descriptions[$key] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : '');
1794
-				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label . ' - ' : '');
1795
-				$descriptions[$key] .= $langs->trans('Qty') . ' : ' . $line->qty;
1796
-				$descriptions[$key] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>';
1793
+				$descriptions[$key] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : '');
1794
+				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label.' - ' : '');
1795
+				$descriptions[$key] .= $langs->trans('Qty').' : '.$line->qty;
1796
+				$descriptions[$key] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>';
1797 1797
 			}
1798 1798
 
1799 1799
 			foreach ($TTotalByTva as $tva => &$total) {
@@ -1817,10 +1817,10 @@  discard block
 block discarded – undo
1817 1817
 				$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
1818 1818
 				$tva_tx = $lines[$i]->tva_tx;
1819 1819
 				$amountdeposit[$tva_tx] += ((float) $lines[$i]->total_ht * (float) $origin->deposit_percent) / 100;
1820
-				$descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : '');
1821
-				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : '');
1822
-				$descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty;
1823
-				$descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>';
1820
+				$descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : '');
1821
+				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : '');
1822
+				$descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty;
1823
+				$descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>';
1824 1824
 			}
1825 1825
 
1826 1826
 			if ($totalamount == 0) {
@@ -1835,11 +1835,11 @@  discard block
 block discarded – undo
1835 1835
 				continue;
1836 1836
 			}
1837 1837
 
1838
-			$descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref;
1838
+			$descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref;
1839 1839
 
1840 1840
 			// Hidden conf
1841 1841
 			if (getDolGlobalString('INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION') && !empty($descriptions[$tva])) {
1842
-				$descline .= '<ul>' . $descriptions[$tva] . '</ul>';
1842
+				$descline .= '<ul>'.$descriptions[$tva].'</ul>';
1843 1843
 			}
1844 1844
 
1845 1845
 			$addlineResult = $deposit->addline(
@@ -2214,9 +2214,9 @@  discard block
 block discarded – undo
2214 2214
 				$this->id = $obj->rowid;
2215 2215
 				$this->entity = $obj->entity;
2216 2216
 
2217
-				$this->ref					= $obj->ref;
2218
-				$this->ref_client			= $obj->ref_client;
2219
-				$this->ref_customer			= $obj->ref_client;
2217
+				$this->ref = $obj->ref;
2218
+				$this->ref_client = $obj->ref_client;
2219
+				$this->ref_customer = $obj->ref_client;
2220 2220
 				$this->ref_ext				= $obj->ref_ext;
2221 2221
 				$this->type					= $obj->type;
2222 2222
 				$this->subtype				= $obj->subtype;
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 				$this->fk_project = $obj->fk_project;
2243 2243
 				$this->project = null; // Clear if another value was already set by fetch_projet
2244 2244
 
2245
-				$this->statut = $obj->status;	// deprecated
2245
+				$this->statut = $obj->status; // deprecated
2246 2246
 				$this->status = $obj->status;
2247 2247
 
2248 2248
 				$this->date_lim_reglement = $this->db->jdate($obj->dlr);
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
 				$this->fk_fac_rec_source	= $obj->fk_fac_rec_source;
2259 2259
 				$this->note = $obj->note_private; // deprecated
2260 2260
 				$this->note_private = $obj->note_private;
2261
-				$this->note_public			= $obj->note_public;
2261
+				$this->note_public = $obj->note_public;
2262 2262
 				$this->user_creation_id     = $obj->fk_user_author;
2263 2263
 				$this->user_validation_id   = $obj->fk_user_valid;
2264 2264
 				$this->user_modification_id = $obj->fk_user_modif;
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 				$line->ref              = $objp->product_ref; // Ref product
2373 2373
 				$line->product_ref      = $objp->product_ref; // Ref product
2374 2374
 				$line->libelle          = $objp->product_label; // deprecated
2375
-				$line->product_label 	= $objp->product_label; // Label product
2375
+				$line->product_label = $objp->product_label; // Label product
2376 2376
 				$line->product_barcode  = $objp->product_barcode; // Barcode number product
2377 2377
 				$line->product_desc     = $objp->product_desc; // Description product
2378 2378
 				$line->fk_product_type  = $objp->fk_product_type; // Type of product
@@ -3246,10 +3246,10 @@  discard block
 block discarded – undo
3246 3246
 		if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'creer'))
3247 3247
 		|| (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'invoice_advance', 'validate'))) {
3248 3248
 			$this->error = 'Permission denied';
3249
-			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3249
+			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3250 3250
 			return -1;
3251 3251
 		}
3252
-		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) &&	// empty should not happened, but when it occurs, the test save life
3252
+		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
3253 3253
 			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')						// If option enabled, we force invoice date
3254 3254
 		) {
3255 3255
 			$this->date = dol_now();
@@ -3418,7 +3418,7 @@  discard block
 block discarded – undo
3418 3418
 					for ($i = 0; $i < $cpt; $i++) {
3419 3419
 						if ($this->lines[$i]->fk_product > 0) {
3420 3420
 							$mouvP = new MouvementStock($this->db);
3421
-							$mouvP->origin = &$this;	// deprecated
3421
+							$mouvP->origin = &$this; // deprecated
3422 3422
 							$mouvP->setOrigin($this->element, $this->id);
3423 3423
 
3424 3424
 							// We decrease stock for product
@@ -3612,7 +3612,7 @@  discard block
 block discarded – undo
3612 3612
 			// Set new ref and define current status
3613 3613
 			if (!$error) {
3614 3614
 				$this->ref = $num;
3615
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
3615
+				$this->statut = self::STATUS_VALIDATED; // deprecated
3616 3616
 				$this->status = self::STATUS_VALIDATED;
3617 3617
 				$this->date_validation = $now;
3618 3618
 				$i = 0;
@@ -3767,7 +3767,7 @@  discard block
 block discarded – undo
3767 3767
 
3768 3768
 			if ($error == 0) {
3769 3769
 				$old_statut = $this->status;
3770
-				$this->statut = self::STATUS_DRAFT;	// deprecated
3770
+				$this->statut = self::STATUS_DRAFT; // deprecated
3771 3771
 				$this->status = self::STATUS_DRAFT;
3772 3772
 
3773 3773
 				// Call trigger
@@ -4671,7 +4671,7 @@  discard block
 block discarded – undo
4671 4671
 		}
4672 4672
 
4673 4673
 		if (!empty($addon)) {
4674
-			dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4674
+			dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4675 4675
 
4676 4676
 			$mybool = false;
4677 4677
 
@@ -5750,14 +5750,14 @@  discard block
 block discarded – undo
5750 5750
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5751 5751
 			$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
5752 5752
 		}
5753
-		$sql .= " WHERE f.paye = 0";	// Only unpaid
5754
-		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;	// Only validated status
5753
+		$sql .= " WHERE f.paye = 0"; // Only unpaid
5754
+		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status
5755 5755
 		if ($datetouse == 'invoicedate') {
5756 5756
 			$sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";
5757 5757
 		} else {
5758 5758
 			$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
5759 5759
 		}
5760
-		$sql .= " AND f.entity IN (".getEntity('facture', 0).")";	// One batch process only one company (no sharing)
5760
+		$sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing)
5761 5761
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5762 5762
 			$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
5763 5763
 		}
@@ -5975,7 +5975,7 @@  discard block
 block discarded – undo
5975 5975
 								$actioncomm->create($user);
5976 5976
 							}
5977 5977
 
5978
-							$this->db->commit();	// We always commit
5978
+							$this->db->commit(); // We always commit
5979 5979
 						}
5980 5980
 
5981 5981
 						if ($errormesg) {
@@ -6017,7 +6017,7 @@  discard block
 block discarded – undo
6017 6017
 		// get date of last validated invoices of same type
6018 6018
 		$sql  = "SELECT datef";
6019 6019
 		$sql .= " FROM ".MAIN_DB_PREFIX."facture";
6020
-		$sql .= " WHERE type = " . (int) $this->type ;
6020
+		$sql .= " WHERE type = ".(int) $this->type;
6021 6021
 		$sql .= " AND date_valid IS NOT NULL";
6022 6022
 		$sql .= " AND entity IN (".getEntity('invoice').")";
6023 6023
 		$sql .= " ORDER BY datef DESC LIMIT 1";
@@ -6275,7 +6275,7 @@  discard block
 block discarded – undo
6275 6275
 			$objp = $this->db->fetch_object($result);
6276 6276
 
6277 6277
 			if (!$objp) {
6278
-				$this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql;
6278
+				$this->error = 'InvoiceLine with id '.$rowid.' not found sql='.$sql;
6279 6279
 				return 0;
6280 6280
 			}
6281 6281
 
@@ -6306,7 +6306,7 @@  discard block
 block discarded – undo
6306 6306
 			$this->total_localtax1		= $objp->total_localtax1;
6307 6307
 			$this->total_localtax2		= $objp->total_localtax2;
6308 6308
 			$this->total_ttc			= $objp->total_ttc;
6309
-			$this->fk_code_ventilation  = $objp->fk_code_ventilation;
6309
+			$this->fk_code_ventilation = $objp->fk_code_ventilation;
6310 6310
 			$this->rang					= $objp->rang;
6311 6311
 			$this->fk_fournprice = $objp->fk_fournprice;
6312 6312
 			$marginInfos				= getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
@@ -6700,7 +6700,7 @@  discard block
 block discarded – undo
6700 6700
 		$sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
6701 6701
 		$sql .= ", product_type=".$this->product_type;
6702 6702
 		$sql .= ", info_bits='".$this->db->escape($this->info_bits)."'";
6703
-		$sql .= ", special_code=" . (int) $this->special_code;
6703
+		$sql .= ", special_code=".(int) $this->special_code;
6704 6704
 		if (empty($this->skip_update_total)) {
6705 6705
 			$sql .= ", total_ht=".price2num($this->total_ht);
6706 6706
 			$sql .= ", total_tva=".price2num($this->total_tva);
Please login to merge, or discard this patch.