Completed
Branch develop (db7a2c)
by
unknown
27:53
created
htdocs/public/onlinesign/newonlinesign.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 $head = '';
240 240
 if (getDolGlobalString('MAIN_SIGN_CSS_URL')) {
241
-	$head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_SIGN_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
241
+	$head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('MAIN_SIGN_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
242 242
 }
243 243
 
244 244
 $conf->dol_hide_topmenu = 1;
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 }
318 318
 if ($source == 'proposal' && getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN')) {
319 319
 	print '<div class="backimagepublicproposalsign">';
320
-	print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN').'">';
320
+	print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN').'">';
321 321
 	print '</div>';
322 322
 }
323 323
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
329 329
 		$text .= $langs->trans($reg[1])."<br>\n";
330 330
 	} else {
331
-		$text .= getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT') . "<br>\n";
331
+		$text .= getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT')."<br>\n";
332 332
 	}
333 333
 	$text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
334 334
 }
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
 	$last_main_doc_file = $object->last_main_doc;
421 421
 
422 422
 	if ($object->status == $object::STATUS_VALIDATED) {
423
-		$object->last_main_doc = preg_replace('/_signed-(\d+)/', '', $object->last_main_doc);	// We want to be sure to not work on the signed version
423
+		$object->last_main_doc = preg_replace('/_signed-(\d+)/', '', $object->last_main_doc); // We want to be sure to not work on the signed version
424 424
 
425 425
 		if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
426 426
 			// It seems document has never been generated, or was generated and then deleted.
427 427
 			// So we try to regenerate it with its default template.
428
-			$defaulttemplate = '';		// We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
428
+			$defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
429 429
 			$object->generateDocument($defaulttemplate, $langs);
430 430
 		}
431 431
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
497 497
 		// It seems document has never been generated, or was generated and then deleted.
498 498
 		// So we try to regenerate it with its default template.
499
-		$defaulttemplate = '';		// We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
499
+		$defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
500 500
 		$object->generateDocument($defaulttemplate, $langs);
501 501
 	}
502 502
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
548 548
 		// It seems document has never been generated, or was generated and then deleted.
549 549
 		// So we try to regenerate it with its default template.
550
-		$defaulttemplate = '';		// We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
550
+		$defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
551 551
 		$object->generateDocument($defaulttemplate, $langs);
552 552
 	}
553 553
 
@@ -571,24 +571,24 @@  discard block
 block discarded – undo
571 571
 	$result = $object->fetch_thirdparty();
572 572
 
573 573
 	// Proposer
574
-	print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Proposer");
574
+	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer");
575 575
 	print '</td><td class="CTableRow2">';
576 576
 	print img_picto('', 'company', 'class="pictofixedwidth"');
577
-	print '<b>' . $creditor . '</b>';
578
-	print '<input type="hidden" name="creditor" value="' . $creditor . '">';
579
-	print '</td></tr>' . "\n";
577
+	print '<b>'.$creditor.'</b>';
578
+	print '<input type="hidden" name="creditor" value="'.$creditor.'">';
579
+	print '</td></tr>'."\n";
580 580
 
581 581
 	// Target
582
-	print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("ThirdParty");
582
+	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
583 583
 	print '</td><td class="CTableRow2">';
584 584
 	print img_picto('', 'company', 'class="pictofixedwidth"');
585
-	print '<b>' . $object->thirdparty->name . '</b>';
586
-	print '</td></tr>' . "\n";
585
+	print '<b>'.$object->thirdparty->name.'</b>';
586
+	print '</td></tr>'."\n";
587 587
 
588 588
 	// Object
589
-	$text = '<b>' . $langs->trans("Signature" . dol_ucfirst($source) . "Ref", $object->ref) . '</b>';
590
-	print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Designation");
591
-	print '</td><td class="CTableRow2">' . $text;
589
+	$text = '<b>'.$langs->trans("Signature".dol_ucfirst($source)."Ref", $object->ref).'</b>';
590
+	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
591
+	print '</td><td class="CTableRow2">'.$text;
592 592
 
593 593
 	$last_main_doc_file = $object->last_main_doc;
594 594
 	$diroutput = $conf->societe->multidir_output[$object->thirdparty->entity].'/'
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
652 652
 		// It seems document has never been generated, or was generated and then deleted.
653 653
 		// So we try to regenerate it with its default template.
654
-		$defaulttemplate = '';		// We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
654
+		$defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
655 655
 		$object->generateDocument($defaulttemplate, $langs);
656 656
 	}
657 657
 	$directdownloadlink = $object->getLastMainDocLink('', 0, 0);
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
701 701
 		// It seems document has never been generated, or was generated and then deleted.
702 702
 		// So we try to regenerate it with its default template.
703
-		$defaulttemplate = '';		// We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
703
+		$defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
704 704
 		$object->generateDocument($defaulttemplate, $langs);
705 705
 	}
706 706
 
@@ -760,8 +760,8 @@  discard block
 block discarded – undo
760 760
 	print '</div>';
761 761
 
762 762
 	// Define $urlwithroot
763
-	$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
764
-	$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT;		// This is to use external domain name found into config file
763
+	$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
764
+	$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
765 765
 	//$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
766 766
 	// TODO Replace DOL_URL_ROOT with $urlwithroot ?
767 767
 
Please login to merge, or discard this patch.
htdocs/core/lib/pdf.lib.php 1 patch
Spacing   +23 added lines, -25 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	//$metric=$arrayformat['unit'];
183 183
 
184 184
 	//$pdfa = false; // PDF default version
185
-	$pdfa = getDolGlobalInt('PDF_USE_A', 0); 	// PDF/A-1 ou PDF/A-3
185
+	$pdfa = getDolGlobalInt('PDF_USE_A', 0); // PDF/A-1 ou PDF/A-3
186 186
 
187 187
 	if (!getDolGlobalString('MAIN_DISABLE_TCPDI') && class_exists('TCPDI')) {
188 188
 		$pdf = new TCPDI($pagetype, $metric, $format, true, 'UTF-8', false, $pdfa);
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 				$stringaddress .= ($stringaddress ? "\n" : '').$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof6);
542 542
 			}
543 543
 			if (getDolGlobalString('PDF_ADD_MORE_AFTER_SOURCE_ADDRESS')) {
544
-				$stringaddress .= ($stringaddress ? "\n" : '') . getDolGlobalString('PDF_ADD_MORE_AFTER_SOURCE_ADDRESS');
544
+				$stringaddress .= ($stringaddress ? "\n" : '').getDolGlobalString('PDF_ADD_MORE_AFTER_SOURCE_ADDRESS');
545 545
 			}
546 546
 		}
547 547
 
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 				if ($usecontact && is_object($targetcontact) && getDolGlobalInt('MAIN_USE_COMPANY_NAME_OF_CONTACT')) {
652 652
 					$targetcontact->fetch_thirdparty();
653 653
 					if (!empty($targetcontact->thirdparty->id) && $targetcontact->thirdparty->tva_intra) {
654
-						$stringaddress .= ($stringaddress ? "\n" : '') . $outputlangs->transnoentities("VATIntraShort") . ': ' . $outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra);
654
+						$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra);
655 655
 					}
656 656
 				} elseif (!empty($targetcompany->tva_intra)) {
657 657
 					$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 	// Add a background image on document only if good setup of const
740 740
 	if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF') && (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF') != '-1')) {		// Warning, this option make TCPDF generation being crazy and some content disappeared behind the image
741
-		$filepath = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF');
741
+		$filepath = $conf->mycompany->dir_output.'/logos/'.getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF');
742 742
 		if (file_exists($filepath)) {
743 743
 			$pdf->setAutoPageBreak(false, 0); // Disable auto pagebreak before adding image
744 744
 			if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) {
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 	$outputlangs->load("dict");
1038 1038
 	$line = '';
1039 1039
 	$reg = array();
1040
-	$marginwithfooter = 0;  // Return value
1040
+	$marginwithfooter = 0; // Return value
1041 1041
 
1042 1042
 	$dims = $pdf->getPageDimensions();
1043 1043
 
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
1171 1171
 	}
1172 1172
 	// Prof Id 6
1173
-	if (!empty($fromcompany->idprof6) &&  $fromcompany->idprof6) {
1173
+	if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) {
1174 1174
 		$field = $outputlangs->transcountrynoentities("ProfId6", $fromcompany->country_code);
1175 1175
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1176 1176
 			$field = $reg[1];
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
1179 1179
 	}
1180 1180
 	// Prof Id 7
1181
-	if (!empty($fromcompany->idprof7) &&  $fromcompany->idprof7) {
1181
+	if (!empty($fromcompany->idprof7) && $fromcompany->idprof7) {
1182 1182
 		$field = $outputlangs->transcountrynoentities("ProfId7", $fromcompany->country_code);
1183 1183
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1184 1184
 			$field = $reg[1];
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof7);
1187 1187
 	}
1188 1188
 	// Prof Id 8
1189
-	if (!empty($fromcompany->idprof8) &&  $fromcompany->idprof8) {
1189
+	if (!empty($fromcompany->idprof8) && $fromcompany->idprof8) {
1190 1190
 		$field = $outputlangs->transcountrynoentities("ProfId8", $fromcompany->country_code);
1191 1191
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1192 1192
 			$field = $reg[1];
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof8);
1195 1195
 	}
1196 1196
 	// Prof Id 9
1197
-	if (!empty($fromcompany->idprof9) &&  $fromcompany->idprof9) {
1197
+	if (!empty($fromcompany->idprof9) && $fromcompany->idprof9) {
1198 1198
 		$field = $outputlangs->transcountrynoentities("ProfId9", $fromcompany->country_code);
1199 1199
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1200 1200
 			$field = $reg[1];
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof9);
1203 1203
 	}
1204 1204
 	// Prof Id 10
1205
-	if (!empty($fromcompany->idprof10) &&  $fromcompany->idprof10) {
1205
+	if (!empty($fromcompany->idprof10) && $fromcompany->idprof10) {
1206 1206
 		$field = $outputlangs->transcountrynoentities("ProfId10", $fromcompany->country_code);
1207 1207
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1208 1208
 			$field = $reg[1];
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof10);
1211 1211
 	}
1212 1212
 	// IntraCommunautary VAT
1213
-	if (!empty($fromcompany->tva_intra)  && $fromcompany->tva_intra != '') {
1213
+	if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra != '') {
1214 1214
 		$line4 .= ($line4 ? " - " : "").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
1215 1215
 	}
1216 1216
 
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
 
1382 1382
 	$pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages();
1383 1383
 	$fontRenderCorrection = 0;
1384
-	if (in_array(pdf_getPDFFont($outputlangs), array('freemono',  'DejaVuSans'))) {
1384
+	if (in_array(pdf_getPDFFont($outputlangs), array('freemono', 'DejaVuSans'))) {
1385 1385
 		$fontRenderCorrection = 10;
1386 1386
 	}
1387 1387
 	$pdf->MultiCell(18 + $fontRenderCorrection, 2, $pagination, 0, 'R', false);
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 
1481 1481
 		if (getDolGlobalString('MARGIN_TOP_ZERO_UL')) {
1482 1482
 			$pdf->setListIndentWidth(5);
1483
-			$TMarginList = ['ul' => [['h' => 0.1, ],['h' => 0.1, ]], 'li' => [['h' => 0.1, ],],];
1483
+			$TMarginList = ['ul' => [['h' => 0.1, ], ['h' => 0.1, ]], 'li' => [['h' => 0.1, ], ], ];
1484 1484
 			$pdf->setHtmlVSpace($TMarginList);
1485 1485
 		}
1486 1486
 
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 		$prodser = new Product($db);
1525 1525
 
1526 1526
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
1527
-			include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
1527
+			include_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
1528 1528
 		}
1529 1529
 	}
1530 1530
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 		$desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc);
1616 1616
 	}
1617 1617
 
1618
-	$libelleproduitservice = '';  // Default value
1618
+	$libelleproduitservice = ''; // Default value
1619 1619
 	if (!getDolGlobalString('PDF_HIDE_PRODUCT_LABEL_IN_SUPPLIER_LINES')) {
1620 1620
 		// Description short of product line
1621 1621
 		$libelleproduitservice = $label;
@@ -1649,8 +1649,7 @@  discard block
 block discarded – undo
1649 1649
 					$libelleproduitservice = dol_concatdesc(
1650 1650
 						dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]),
1651 1651
 						(!empty($qtyText) ?
1652
-							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText :
1653
-							$outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1652
+							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText : $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1654 1653
 					);
1655 1654
 				}
1656 1655
 			} else {
@@ -1658,8 +1657,7 @@  discard block
 block discarded – undo
1658 1657
 					$libelleproduitservice = dol_concatdesc(
1659 1658
 						dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]),
1660 1659
 						(!empty($qtyText) ?
1661
-							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText :
1662
-							$outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1660
+							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText : $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1663 1661
 					);
1664 1662
 				}
1665 1663
 			}
@@ -1771,11 +1769,11 @@  discard block
 block discarded – undo
1771 1769
 								break;
1772 1770
 
1773 1771
 							case 2:
1774
-								$ref_prodserv = $productCustomerPrice->ref_customer . ' (' . $outputlangs->transnoentitiesnoconv('InternalRef') . ' ' . $ref_prodserv . ')';
1772
+								$ref_prodserv = $productCustomerPrice->ref_customer.' ('.$outputlangs->transnoentitiesnoconv('InternalRef').' '.$ref_prodserv.')';
1775 1773
 								break;
1776 1774
 
1777 1775
 							default:
1778
-								$ref_prodserv = $ref_prodserv . ' (' . $outputlangs->transnoentitiesnoconv('RefCustomer') . ' ' . $productCustomerPrice->ref_customer . ')';
1776
+								$ref_prodserv = $ref_prodserv.' ('.$outputlangs->transnoentitiesnoconv('RefCustomer').' '.$productCustomerPrice->ref_customer.')';
1779 1777
 						}
1780 1778
 					}
1781 1779
 				}
@@ -2638,7 +2636,7 @@  discard block
 block discarded – undo
2638 2636
 						}
2639 2637
 					}
2640 2638
 					$refListsTxt .= (!empty($refListsTxt) ? ' ' : '');
2641
-					if (! is_object($order)) {
2639
+					if (!is_object($order)) {
2642 2640
 						$refListsTxt .= $outputlangs->transnoentities($elementobject->ref);
2643 2641
 					} else {
2644 2642
 						$refListsTxt .= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '');
@@ -2665,7 +2663,7 @@  discard block
 block discarded – undo
2665 2663
 					}
2666 2664
 				}
2667 2665
 
2668
-				if (! is_object($order)) {
2666
+				if (!is_object($order)) {
2669 2667
 					$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
2670 2668
 					if (empty($linkedobjects[$objecttype]['ref_value'])) {
2671 2669
 						$linkedobjects[$objecttype]['ref_value'] = '';
@@ -2772,7 +2770,7 @@  discard block
 block discarded – undo
2772 2770
 				if (isset($hookmanager->resArray['linetotalremise'])) {
2773 2771
 					return (float) $hookmanager->resArray['linetotalremise'];
2774 2772
 				} else {
2775
-					return (float) $hookmanager->resPrint;	// For backward compatibility
2773
+					return (float) $hookmanager->resPrint; // For backward compatibility
2776 2774
 				}
2777 2775
 			}
2778 2776
 		}
@@ -2806,7 +2804,7 @@  discard block
 block discarded – undo
2806 2804
 
2807 2805
 		// Remove non printablecaracters
2808 2806
 		$content = preg_replace('/[^(\x20-\x7F)]*/', '', $content);
2809
-		if (preg_match('/\/' . preg_quote($field, '/') . '\s*\((.*?)\)/', $content, $matches)) {
2807
+		if (preg_match('/\/'.preg_quote($field, '/').'\s*\((.*?)\)/', $content, $matches)) {
2810 2808
 			return trim($matches[1]);
2811 2809
 		}
2812 2810
 		return "ERROR: NOT FOUND";
Please login to merge, or discard this patch.
htdocs/core/ajax/onlineSign.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
 if (!defined('NOBROWSERNOTIF')) {
50 50
 	define('NOBROWSERNOTIF', '1');
51 51
 }
52
-$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));	// Keep $_GET and $_POST here. GETPOST not yet defined.
52
+$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined.
53 53
 if (is_numeric($entity)) {
54 54
 	define("DOLENTITY", $entity);
55 55
 }
56 56
 include '../../main.inc.php';
57
-require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
57
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
58 58
 /**
59 59
  * @var Conf $conf
60 60
  * @var DoliDB $db
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 $signature = GETPOST('signaturebase64');
69 69
 $ref = GETPOST('ref', 'aZ09');
70
-$mode = GETPOST('mode', 'aZ09');    // 'proposal', ...
70
+$mode = GETPOST('mode', 'aZ09'); // 'proposal', ...
71 71
 $SECUREKEY = GETPOST("securekey"); // Secure key
72 72
 $online_sign_name = GETPOST("onlinesignname");
73 73
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	$securekeyseed = getDolGlobalString(strtoupper($type).'_ONLINE_SIGNATURE_SECURITY_TOKEN');
89 89
 }
90 90
 
91
-if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) {
92
-	httponly_accessforbidden('Bad value for securitykey. Value provided ' . dol_escape_htmltag($SECUREKEY) . ' does not match expected value for ref=' . dol_escape_htmltag($ref), 403);
91
+if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) {
92
+	httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403);
93 93
 }
94 94
 
95 95
 // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
@@ -116,29 +116,29 @@  discard block
 block discarded – undo
116 116
 		$data = base64_decode($signature);
117 117
 
118 118
 		if ($mode == "propale" || $mode == 'proposal') {
119
-			require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
120
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php';
119
+			require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
120
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
121 121
 			$object = new Propal($db);
122 122
 			$object->fetch(0, $ref);
123 123
 
124 124
 			$upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output;
125
-			$upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/';
125
+			$upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/';
126 126
 
127
-			$default_font_size = pdf_getPDFFontSize($langs);    // Must be after pdf_getInstance
128
-			$default_font = pdf_getPDFFont($langs);    // Must be after pdf_getInstance
127
+			$default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance
128
+			$default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance
129 129
 			$langs->loadLangs(array("main", "companies"));
130 130
 
131 131
 			$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
132
-			$filename = "signatures/" . $date . "_signature.png";
133
-			if (!is_dir($upload_dir . "signatures/")) {
134
-				if (!dol_mkdir($upload_dir . "signatures/")) {
135
-					$response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/";
132
+			$filename = "signatures/".$date."_signature.png";
133
+			if (!is_dir($upload_dir."signatures/")) {
134
+				if (!dol_mkdir($upload_dir."signatures/")) {
135
+					$response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/";
136 136
 					$error++;
137 137
 				}
138 138
 			}
139 139
 
140 140
 			if (!$error) {
141
-				$return = file_put_contents($upload_dir . $filename, $data);
141
+				$return = file_put_contents($upload_dir.$filename, $data);
142 142
 				if ($return == false) {
143 143
 					$error++;
144 144
 					$response = 'Error file_put_content: failed to create signature file.';
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 			if (!$error) {
149 149
 				// Defined modele of doc
150 150
 				$last_main_doc_file = $object->last_main_doc;
151
-				$directdownloadlink = $object->getLastMainDocLink('proposal');    // url to download the $object->last_main_doc
151
+				$directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc
152 152
 
153 153
 				if (preg_match('/\.pdf/i', $last_main_doc_file)) {
154 154
 					$ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF
155 155
 					$ref_pdf = preg_replace('/_signed-(\d+)/', '', $ref_pdf);
156 156
 
157
-					$newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf";
158
-					$sourcefile = $upload_dir . $ref_pdf . ".pdf";
157
+					$newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf";
158
+					$sourcefile = $upload_dir.$ref_pdf.".pdf";
159 159
 
160 160
 					if (dol_is_file($sourcefile)) {
161 161
 						$parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename);
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 							}
179 179
 
180 180
 							//$pdf->Open();
181
-							$pagecount = $pdf->setSourceFile($sourcefile);        // original PDF
181
+							$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
182 182
 
183 183
 							$param = array();
184 184
 							$param['online_sign_name'] = $online_sign_name;
185
-							$param['pathtoimage'] = $upload_dir . $filename;
185
+							$param['pathtoimage'] = $upload_dir.$filename;
186 186
 
187 187
 							$propalsignonspecificpage = getDolGlobalInt("PROPAL_SIGNATURE_ON_SPECIFIC_PAGE");
188 188
 
189
-							$s = array();    // Array with size of each page. Example array(w'=>210, 'h'=>297);
189
+							$s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297);
190 190
 							for ($i = 1; $i < ($pagecount + 1); $i++) {
191 191
 								try {
192 192
 									$tppl = $pdf->importPage($i);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 										dolPrintSignatureImage($pdf, $langs, $param);
231 231
 									}
232 232
 								} catch (Exception $e) {
233
-									dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR);
233
+									dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR);
234 234
 									$response = $e->getMessage();
235 235
 									$error++;
236 236
 								}
@@ -279,14 +279,14 @@  discard block
 block discarded – undo
279 279
 
280 280
 				$online_sign_ip = getUserRemoteIP();
281 281
 
282
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
283
-				$sql .= " SET fk_statut = " . ((int) $object::STATUS_SIGNED) . ", note_private = '" . $db->escape($object->note_private) . "',";
284
-				$sql .= " date_signature = '" . $db->idate(dol_now()) . "',";
285
-				$sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'";
282
+				$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
283
+				$sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$db->escape($object->note_private)."',";
284
+				$sql .= " date_signature = '".$db->idate(dol_now())."',";
285
+				$sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'";
286 286
 				if ($online_sign_name) {
287
-					$sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'";
287
+					$sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'";
288 288
 				}
289
-				$sql .= " WHERE rowid = " . ((int) $object->id);
289
+				$sql .= " WHERE rowid = ".((int) $object->id);
290 290
 
291 291
 				dol_syslog(__FILE__, LOG_DEBUG);
292 292
 				$resql = $db->query($sql);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 						$result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user);
306 306
 						if ($result < 0) {
307 307
 							$error++;
308
-							$response = "error in trigger " . $object->error;
308
+							$response = "error in trigger ".$object->error;
309 309
 						} else {
310 310
 							$soc = new Societe($db);
311 311
 							$soc->id = $object->socid;
@@ -334,25 +334,25 @@  discard block
 block discarded – undo
334 334
 				}
335 335
 			}
336 336
 		} elseif ($mode == 'contract') {
337
-			require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
338
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php';
337
+			require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
338
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
339 339
 			$object = new Contrat($db);
340 340
 			$object->fetch(0, $ref);
341 341
 
342 342
 			$upload_dir = !empty($conf->contrat->multidir_output[$object->entity]) ? $conf->contrat->multidir_output[$object->entity] : $conf->contrat->dir_output;
343
-			$upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/';
343
+			$upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/';
344 344
 
345 345
 			$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
346
-			$filename = "signatures/" . $date . "_signature.png";
347
-			if (!is_dir($upload_dir . "signatures/")) {
348
-				if (!dol_mkdir($upload_dir . "signatures/")) {
349
-					$response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/";
346
+			$filename = "signatures/".$date."_signature.png";
347
+			if (!is_dir($upload_dir."signatures/")) {
348
+				if (!dol_mkdir($upload_dir."signatures/")) {
349
+					$response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/";
350 350
 					$error++;
351 351
 				}
352 352
 			}
353 353
 
354 354
 			if (!$error) {
355
-				$return = file_put_contents($upload_dir . $filename, $data);
355
+				$return = file_put_contents($upload_dir.$filename, $data);
356 356
 				if ($return == false) {
357 357
 					$error++;
358 358
 					$response = 'Error file_put_content: failed to create signature file.';
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
 			if (!$error) {
363 363
 				// Defined modele of doc
364 364
 				$last_main_doc_file = $object->last_main_doc;
365
-				$directdownloadlink = $object->getLastMainDocLink('contrat');    // url to download the $object->last_main_doc
365
+				$directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc
366 366
 
367 367
 				if (preg_match('/\.pdf/i', $last_main_doc_file)) {
368 368
 					$ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF
369 369
 
370
-					$newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf";
371
-					$sourcefile = $upload_dir . $ref_pdf . ".pdf";
370
+					$newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf";
371
+					$sourcefile = $upload_dir.$ref_pdf.".pdf";
372 372
 
373 373
 					if (dol_is_file($sourcefile)) {
374 374
 						$parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename);
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 							}
392 392
 
393 393
 							//$pdf->Open();
394
-							$pagecount = $pdf->setSourceFile($sourcefile);        // original PDF
394
+							$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
395 395
 
396 396
 							$param = array();
397 397
 							$param['online_sign_name'] = $online_sign_name;
398
-							$param['pathtoimage'] = $upload_dir . $filename;
398
+							$param['pathtoimage'] = $upload_dir.$filename;
399 399
 
400
-							$s = array();    // Array with size of each page. Example array(w'=>210, 'h'=>297);
400
+							$s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297);
401 401
 							for ($i = 1; $i < ($pagecount + 1); $i++) {
402 402
 								try {
403 403
 									$tppl = $pdf->importPage($i);
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 										dolPrintSignatureImage($pdf, $langs, $param);
429 429
 									}
430 430
 								} catch (Exception $e) {
431
-									dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
431
+									dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR);
432 432
 									$response = $e->getMessage();
433 433
 									$error++;
434 434
 								}
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 				$object->setSignedStatus($user, Contrat::$SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'CONTRACT_MODIFY');
467 467
 			}
468 468
 		} elseif ($mode == 'fichinter') {
469
-			require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
470
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php';
469
+			require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
470
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
471 471
 			$object = new Fichinter($db);
472 472
 			$object->fetch(0, $ref);
473 473
 
@@ -476,20 +476,20 @@  discard block
 block discarded – undo
476 476
 
477 477
 			$langs->loadLangs(array("main", "companies"));
478 478
 
479
-			$default_font_size = pdf_getPDFFontSize($langs);	// Must be after pdf_getInstance
480
-			$default_font = pdf_getPDFFont($langs);	// Must be
479
+			$default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance
480
+			$default_font = pdf_getPDFFont($langs); // Must be
481 481
 
482 482
 			$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
483
-			$filename = "signatures/" . $date . "_signature.png";
484
-			if (!is_dir($upload_dir . "signatures/")) {
485
-				if (!dol_mkdir($upload_dir . "signatures/")) {
486
-					$response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/";
483
+			$filename = "signatures/".$date."_signature.png";
484
+			if (!is_dir($upload_dir."signatures/")) {
485
+				if (!dol_mkdir($upload_dir."signatures/")) {
486
+					$response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/";
487 487
 					$error++;
488 488
 				}
489 489
 			}
490 490
 
491 491
 			if (!$error) {
492
-				$return = file_put_contents($upload_dir . $filename, $data);
492
+				$return = file_put_contents($upload_dir.$filename, $data);
493 493
 				if ($return == false) {
494 494
 					$error++;
495 495
 					$response = 'Error file_put_content: failed to create signature file.';
@@ -499,13 +499,13 @@  discard block
 block discarded – undo
499 499
 			if (!$error) {
500 500
 				// Defined modele of doc
501 501
 				$last_main_doc_file = $object->last_main_doc;
502
-				$directdownloadlink = $object->getLastMainDocLink('fichinter');    // url to download the $object->last_main_doc
502
+				$directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc
503 503
 
504 504
 				if (preg_match('/\.pdf/i', $last_main_doc_file)) {
505 505
 					$ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF
506 506
 
507
-					$newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf";
508
-					$sourcefile = $upload_dir . $ref_pdf . ".pdf";
507
+					$newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf";
508
+					$sourcefile = $upload_dir.$ref_pdf.".pdf";
509 509
 
510 510
 					if (dol_is_file($sourcefile)) {
511 511
 						$parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename);
@@ -528,13 +528,13 @@  discard block
 block discarded – undo
528 528
 							}
529 529
 
530 530
 							//$pdf->Open();
531
-							$pagecount = $pdf->setSourceFile($sourcefile);        // original PDF
531
+							$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
532 532
 
533 533
 							$param = array();
534 534
 							$param['online_sign_name'] = $online_sign_name;
535
-							$param['pathtoimage'] = $upload_dir . $filename;
535
+							$param['pathtoimage'] = $upload_dir.$filename;
536 536
 
537
-							$s = array();    // Array with size of each page. Example array(w'=>210, 'h'=>297);
537
+							$s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297);
538 538
 							for ($i = 1; $i < ($pagecount + 1); $i++) {
539 539
 								try {
540 540
 									$tppl = $pdf->importPage($i);
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 										dolPrintSignatureImage($pdf, $langs, $param);
566 566
 									}
567 567
 								} catch (Exception $e) {
568
-									dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
568
+									dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR);
569 569
 									$response = $e->getMessage();
570 570
 									$error++;
571 571
 								}
@@ -604,39 +604,39 @@  discard block
 block discarded – undo
604 604
 			}
605 605
 		} elseif ($mode == "societe_rib") {
606 606
 			$langs->load('withdrawals');
607
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
608
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php';
607
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
608
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
609 609
 			$modelpath = "core/modules/bank/doc/";
610 610
 			$object = new CompanyBankAccount($db);
611 611
 			$object->fetch(0, $ref);
612 612
 			if (!empty($object->id)) {
613 613
 				$object->fetch_thirdparty();
614 614
 
615
-				$upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity] . '/' . dol_sanitizeFileName((string) $object->thirdparty->id) . '/';
615
+				$upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity].'/'.dol_sanitizeFileName((string) $object->thirdparty->id).'/';
616 616
 
617
-				$default_font_size = pdf_getPDFFontSize($langs);    // Must be after pdf_getInstance
618
-				$default_font = pdf_getPDFFont($langs);    // Must be after pdf_getInstance
617
+				$default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance
618
+				$default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance
619 619
 				$langs->loadLangs(array("main", "companies"));
620 620
 
621 621
 				$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
622
-				$filename = "signatures/" . $date . "_signature.png";
623
-				if (!dol_is_dir($upload_dir . "signatures/")) {
624
-					if (!dol_mkdir($upload_dir . "signatures/")) {
625
-						$response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/";
622
+				$filename = "signatures/".$date."_signature.png";
623
+				if (!dol_is_dir($upload_dir."signatures/")) {
624
+					if (!dol_mkdir($upload_dir."signatures/")) {
625
+						$response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/";
626 626
 						$error++;
627 627
 					}
628 628
 				}
629
-				if (!dol_is_writable($upload_dir . "signatures/")) {
630
-					$response = "Error directory " . $upload_dir . "signatures/ is not writable";
629
+				if (!dol_is_writable($upload_dir."signatures/")) {
630
+					$response = "Error directory ".$upload_dir."signatures/ is not writable";
631 631
 					$error++;
632 632
 				}
633 633
 				if (!dol_is_writable(DOL_DATA_ROOT.'/admin/temp/')) {	// This is used by TCPDF as working directory
634
-					$response = "Error directory " . DOL_DATA_ROOT."/admin/temp/ is not writable";
634
+					$response = "Error directory ".DOL_DATA_ROOT."/admin/temp/ is not writable";
635 635
 					$error++;
636 636
 				}
637 637
 
638 638
 				if (!$error) {
639
-					$return = file_put_contents($upload_dir . $filename, $data);
639
+					$return = file_put_contents($upload_dir.$filename, $data);
640 640
 					if ($return == false) {
641 641
 						$error++;
642 642
 						$response = 'Error file_put_content: failed to create signature file.';
@@ -647,14 +647,14 @@  discard block
 block discarded – undo
647 647
 					// Defined modele of doc
648 648
 					$last_main_doc_file = $object->last_main_doc;
649 649
 					$last_modelpdf = $object->model_pdf;
650
-					$directdownloadlink = $object->getLastMainDocLink('company');    // url to download the $object->last_main_doc
650
+					$directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc
651 651
 
652 652
 					if (preg_match('/\.pdf/i', $last_main_doc_file)) {
653 653
 						$sourcefile = '';
654 654
 						$newpdffilename = '';
655 655
 						if ($last_modelpdf == 'sepamandate') {
656
-							$newpdffilename = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . "_signed-" . $date . ".pdf";
657
-							$sourcefile = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . ".pdf";
656
+							$newpdffilename = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum)."_signed-".$date.".pdf";
657
+							$sourcefile = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum).".pdf";
658 658
 						}
659 659
 						if (dol_is_file($sourcefile)) {
660 660
 							$parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename);
@@ -677,9 +677,9 @@  discard block
 block discarded – undo
677 677
 								}
678 678
 
679 679
 								//$pdf->Open();
680
-								$pagecount = $pdf->setSourceFile($sourcefile);        // original PDF
680
+								$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
681 681
 
682
-								$s = array();    // Array with size of each page. Example array(w'=>210, 'h'=>297);
682
+								$s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297);
683 683
 								for ($i = 1; $i < ($pagecount + 1); $i++) {
684 684
 									try {
685 685
 										$tppl = $pdf->importPage($i);
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 										$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
688 688
 										$pdf->useTemplate($tppl);
689 689
 									} catch (Exception $e) {
690
-										dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR);
690
+										dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR);
691 691
 										$response = $e->getMessage();
692 692
 										$error++;
693 693
 									}
@@ -703,18 +703,18 @@  discard block
 block discarded – undo
703 703
 									$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
704 704
 								}
705 705
 								foreach ($dirmodels as $reldir) {
706
-									$file = "pdf_" . $last_modelpdf . ".modules.php";
706
+									$file = "pdf_".$last_modelpdf.".modules.php";
707 707
 									// On vérifie l'emplacement du modele
708
-									$file = dol_buildpath($reldir . $modelpath . $file, 0);
708
+									$file = dol_buildpath($reldir.$modelpath.$file, 0);
709 709
 									if (file_exists($file)) {
710 710
 										$filefound = $file;
711
-										$classname = 'pdf_' . $last_modelpdf;
711
+										$classname = 'pdf_'.$last_modelpdf;
712 712
 										break;
713 713
 									}
714 714
 								}
715 715
 
716 716
 								if ($filefound === '') {
717
-									$response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf;
717
+									$response = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelpath.' - modele='.$last_modelpdf;
718 718
 									dol_syslog($response, LOG_ERR);
719 719
 									$error++;
720 720
 								}
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 									$param = array();
740 740
 									$param['online_sign_name'] = $online_sign_name;
741
-									$param['pathtoimage'] = $upload_dir . $filename;
741
+									$param['pathtoimage'] = $upload_dir.$filename;
742 742
 
743 743
 									// A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF
744 744
 									// TODO Get position of box from PDF template
@@ -774,16 +774,16 @@  discard block
 block discarded – undo
774 774
 
775 775
 				$online_sign_ip = getUserRemoteIP();
776 776
 
777
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $object->table_element;
777
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$object->table_element;
778 778
 				$sql .= " SET ";
779
-				$sql .= " date_signature = '" . $db->idate(dol_now()) . "',";
780
-				$sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'";
779
+				$sql .= " date_signature = '".$db->idate(dol_now())."',";
780
+				$sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'";
781 781
 				if ($online_sign_name) {
782
-					$sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'";
782
+					$sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'";
783 783
 				}
784 784
 				//$sql .= ", last_main_doc = '" . $db->escape($object->element'..') . "'";
785 785
 
786
-				$sql .= " WHERE rowid = " . ((int) $object->id);
786
+				$sql .= " WHERE rowid = ".((int) $object->id);
787 787
 
788 788
 				dol_syslog(__FILE__, LOG_DEBUG);
789 789
 				$resql = $db->query($sql);
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
 				}
810 810
 			}
811 811
 		} elseif ($mode == 'expedition') {
812
-			require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
813
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php';
812
+			require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
813
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
814 814
 
815 815
 			$object = new Expedition($db);
816 816
 			$object->fetch(0, $ref);
@@ -820,20 +820,20 @@  discard block
 block discarded – undo
820 820
 
821 821
 			$langs->loadLangs(array("main", "companies"));
822 822
 
823
-			$default_font_size = pdf_getPDFFontSize($langs);	// Must be after pdf_getInstance
824
-			$default_font = pdf_getPDFFont($langs);	// Must be
823
+			$default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance
824
+			$default_font = pdf_getPDFFont($langs); // Must be
825 825
 
826 826
 			$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
827
-			$filename = "signatures/" . $date . "_signature.png";
828
-			if (!is_dir($upload_dir . "signatures/")) {
829
-				if (!dol_mkdir($upload_dir . "signatures/")) {
830
-					$response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/";
827
+			$filename = "signatures/".$date."_signature.png";
828
+			if (!is_dir($upload_dir."signatures/")) {
829
+				if (!dol_mkdir($upload_dir."signatures/")) {
830
+					$response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/";
831 831
 					$error++;
832 832
 				}
833 833
 			}
834 834
 
835 835
 			if (!$error) {
836
-				$return = file_put_contents($upload_dir . $filename, $data);
836
+				$return = file_put_contents($upload_dir.$filename, $data);
837 837
 				if ($return == false) {
838 838
 					$error++;
839 839
 					$response = 'Error file_put_content: failed to create signature file.';
@@ -846,17 +846,17 @@  discard block
 block discarded – undo
846 846
 				if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
847 847
 					// It seems document has never been generated, or was generated and then deleted.
848 848
 					// So we try to regenerate it with its default template.
849
-					$defaulttemplate = '';		// We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
849
+					$defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
850 850
 					$object->generateDocument($defaulttemplate, $langs);
851 851
 				}
852 852
 				$last_main_doc_file = $object->last_main_doc;
853
-				$directdownloadlink = $object->getLastMainDocLink('expedition');    // url to download the $object->last_main_doc
853
+				$directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc
854 854
 
855 855
 				if (preg_match('/\.pdf/i', $last_main_doc_file)) {
856 856
 					$ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF
857 857
 
858
-					$newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf";
859
-					$sourcefile = $upload_dir . $ref_pdf . ".pdf";
858
+					$newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf";
859
+					$sourcefile = $upload_dir.$ref_pdf.".pdf";
860 860
 
861 861
 					if (dol_is_file($sourcefile)) {
862 862
 						$parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename);
@@ -879,13 +879,13 @@  discard block
 block discarded – undo
879 879
 							}
880 880
 
881 881
 							//$pdf->Open();
882
-							$pagecount = $pdf->setSourceFile($sourcefile);        // original PDF
882
+							$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
883 883
 
884 884
 							$param = array();
885 885
 							$param['online_sign_name'] = $online_sign_name;
886
-							$param['pathtoimage'] = $upload_dir . $filename;
886
+							$param['pathtoimage'] = $upload_dir.$filename;
887 887
 
888
-							$s = array();    // Array with size of each page. Example array(w'=>210, 'h'=>297);
888
+							$s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297);
889 889
 							for ($i = 1; $i < ($pagecount + 1); $i++) {
890 890
 								try {
891 891
 									$tppl = $pdf->importPage($i);
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 										dolPrintSignatureImage($pdf, $langs, $param);
905 905
 									}
906 906
 								} catch (Exception $e) {
907
-									dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
907
+									dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR);
908 908
 									$response = $e->getMessage();
909 909
 									$error++;
910 910
 								}
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
  */
966 966
 function dolPrintSignatureImage(TCPDF $pdf, $langs, $params)
967 967
 {
968
-	$default_font_size = pdf_getPDFFontSize($langs);	// Must be after pdf_getInstance
969
-	$default_font = pdf_getPDFFont($langs);	// Must be
968
+	$default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance
969
+	$default_font = pdf_getPDFFont($langs); // Must be
970 970
 	$xforimgstart = $params['xforimgstart'];
971 971
 	$yforimgstart = $params['yforimgstart'];
972 972
 	$wforimg = $params['wforimg'];
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	$pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4);
975 975
 	$pdf->SetFont($default_font, '', $default_font_size - 1);
976 976
 	$pdf->SetTextColor(80, 80, 80);
977
-	$pdf->MultiCell($wforimg, 4, $langs->trans("Signature") . ': ' . dol_print_date(dol_now(), "day", false, $langs, true). ' - '.$params['online_sign_name'], 0, 'L');
977
+	$pdf->MultiCell($wforimg, 4, $langs->trans("Signature").': '.dol_print_date(dol_now(), "day", false, $langs, true).' - '.$params['online_sign_name'], 0, 'L');
978 978
 	//$pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4));
979 979
 	//$pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L');
980 980
 
Please login to merge, or discard this patch.
htdocs/takepos/index.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
 $arrayofcss = array('/takepos/css/pos.css.php', '/takepos/css/colorbox.css');
132 132
 
133 133
 if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) {
134
-	$arrayofcss[] =  '/takepos/css/colorful.css';
134
+	$arrayofcss[] = '/takepos/css/colorful.css';
135 135
 }
136 136
 
137 137
 
138 138
 // Title
139 139
 $title = 'TakePOS - Dolibarr '.DOL_VERSION;
140 140
 if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
141
-	$title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE');
141
+	$title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE');
142 142
 }
143 143
 $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
144 144
 <meta name="apple-mobile-web-app-capable" content="yes">
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 		limit = maxproduct - 1;
361 361
 	}
362 362
 	// Only show products for sale (tosell=1)
363
-	$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
363
+	$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken(); ?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
364 364
 		console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
365 365
 		//console.log(data);
366 366
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 	}
482 482
 	var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts;
483 483
 	// Only show products for sale (tosell=1)
484
-	$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
484
+	$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken(); ?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
485 485
 		console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
486 486
 
487 487
 		if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 function ChangeThirdparty(idcustomer) {
574 574
 	 console.log("ChangeThirdparty");
575 575
 		// Call page list.php to change customer
576
-		$("#poslines").load("<?php echo DOL_URL_ROOT ?>/societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() {
576
+		$("#poslines").load("<?php echo DOL_URL_ROOT ?>/societe/list.php?action=change&token=<?php echo newToken(); ?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() {
577 577
 		});
578 578
 
579 579
 	ClearSearch(false);
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 
682 682
 	console.log("New with place = <?php echo $place; ?>, js place="+place+", invoiceid="+invoiceid);
683 683
 
684
-	$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id='+invoiceid, function(data) {
684
+	$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken(); ?>&id='+invoiceid, function(data) {
685 685
 		var r;
686 686
 
687 687
 		if (parseInt(data['paye']) === 1) {
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 			pageproducts = 0;
755 755
 			jQuery(".wrapper2 .catwatermark").hide();
756 756
 			var nbsearchresults = 0;
757
-			$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&search_term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
757
+			$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken(); ?>&search_term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
758 758
 				for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
759 759
 					if (typeof (data[i]) == "undefined") {
760 760
 						$("#prowatermark" + i).html("");
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 				}
850 850
 				else {
851 851
 					$("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
852
-					var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
852
+					var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2; ?>));
853 853
 					$("#search_start_less").val(search_start_less);
854 854
 				}
855 855
 				if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 				}
858 858
 				else {
859 859
 					$("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
860
-					var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
860
+					var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2; ?>);
861 861
 					$("#search_start_more").val(search_start_more);
862 862
 				}
863 863
 			});
@@ -954,14 +954,14 @@  discard block
 block discarded – undo
954 954
 
955 955
 function TakeposPrintingOrder(){
956 956
 	console.log("TakeposPrintingOrder");
957
-	$("#poslines").load("invoice.php?action=order&token=<?php echo newToken();?>&place="+place, function() {
957
+	$("#poslines").load("invoice.php?action=order&token=<?php echo newToken(); ?>&place="+place, function() {
958 958
 		//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
959 959
 	});
960 960
 }
961 961
 
962 962
 function TakeposPrintingTemp(){
963 963
 	console.log("TakeposPrintingTemp");
964
-	$("#poslines").load("invoice.php?action=temp&token=<?php echo newToken();?>&place="+place, function() {
964
+	$("#poslines").load("invoice.php?action=temp&token=<?php echo newToken(); ?>&place="+place, function() {
965 965
 		//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
966 966
 	});
967 967
 }
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 }
984 984
 
985 985
 function DolibarrOpenDrawer() {
986
-	console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode(empty($_SESSION["takeposterminal"]) ? '' : $_SESSION["takeposterminal"]); ?>");
986
+	console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken(); ?>&term=<?php print urlencode(empty($_SESSION["takeposterminal"]) ? '' : $_SESSION["takeposterminal"]); ?>");
987 987
 	$.ajax({
988 988
 		type: "GET",
989 989
 		data: { token: '<?php echo currentToken(); ?>' },
@@ -1332,8 +1332,8 @@  discard block
 block discarded – undo
1332 1332
 
1333 1333
 // TakePOS setup check
1334 1334
 if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
1335
-	$sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement";
1336
-	$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
1335
+	$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
1336
+	$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
1337 1337
 	$sql .= " AND active = 1";
1338 1338
 	$sql .= " ORDER BY libelle";
1339 1339
 
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 				$paycode = 'CHEQUE';
1350 1350
 			}
1351 1351
 
1352
-			$constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
1352
+			$constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
1353 1353
 			//var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
1354 1354
 			if (getDolGlobalInt($constantforkey) > 0) {
1355 1355
 				array_push($paiementsModes, $obj);
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 		$menus[$r++] = array('title' => '<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action' => 'Customer();');
1392 1392
 	}
1393 1393
 }
1394
-if (! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1394
+if (!getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1395 1395
 	$menus[$r++] = array('title' => '<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action' => 'History();');
1396 1396
 }
1397 1397
 $menus[$r++] = array('title' => '<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action' => 'FreeZone();');
Please login to merge, or discard this patch.
htdocs/product/card.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 $formbarcode = null;
109 109
 
110 110
 // Get parameters
111
-$id  = GETPOSTINT('id');
111
+$id = GETPOSTINT('id');
112 112
 if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) {
113 113
 	$ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'nohtml') : null);
114 114
 } else {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 $backtopage = GETPOST('backtopage', 'alpha');
121 121
 $confirm = GETPOST('confirm', 'alpha');
122 122
 $socid = GETPOSTINT('socid');
123
-$duration_value = GETPOST('duration_value');	// duration value can be an empty string
123
+$duration_value = GETPOST('duration_value'); // duration value can be an empty string
124 124
 $duration_unit = GETPOST('duration_unit', 'alpha');
125 125
 
126 126
 $accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
 	// Quick edit for extrafields
492 492
 	if ($action == 'update_extras' && $usercancreate) {
493
-		$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
493
+		$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
494 494
 
495 495
 		// Fill array 'array_options' with data from update form
496 496
 		$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 		if (!$error) {
544 544
 			$units = GETPOSTINT('units');
545 545
 
546
-			$object->entity				= $conf->entity;
547
-			$object->ref				= (string) $ref;
548
-			$object->label				= GETPOST('label', $label_security_check);
549
-			$object->price_base_type	= GETPOST('price_base_type', 'aZ09');
550
-			$object->mandatory_period	= empty(GETPOST("mandatoryperiod", 'alpha')) ? 0 : 1;
546
+			$object->entity = $conf->entity;
547
+			$object->ref = (string) $ref;
548
+			$object->label = GETPOST('label', $label_security_check);
549
+			$object->price_base_type = GETPOST('price_base_type', 'aZ09');
550
+			$object->mandatory_period = empty(GETPOST("mandatoryperiod", 'alpha')) ? 0 : 1;
551 551
 			if ($object->price_base_type == 'TTC') {
552 552
 				$object->price_ttc = GETPOSTFLOAT('price');
553 553
 			} else {
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 			$object->duration_value     	 = $duration_value;
636 636
 			$object->duration_unit      	 = $duration_unit;
637 637
 			$object->fk_default_warehouse	 = GETPOSTINT('fk_default_warehouse');
638
-			$object->fk_default_workstation	 = GETPOSTINT('fk_default_workstation');
638
+			$object->fk_default_workstation = GETPOSTINT('fk_default_workstation');
639 639
 			$object->seuil_stock_alerte 	 = GETPOST('seuil_stock_alerte') ? GETPOST('seuil_stock_alerte') : 0;
640 640
 			$object->desiredstock          = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0;
641 641
 			$object->canvas             	 = GETPOST('canvas');
642 642
 			$object->net_measure           = GETPOST('net_measure');
643
-			$object->net_measure_units      = GETPOST('net_measure_units') === '' ? null : GETPOSTINT('net_measure_units'); // This is not the fk_unit but the power of unit
643
+			$object->net_measure_units = GETPOST('net_measure_units') === '' ? null : GETPOSTINT('net_measure_units'); // This is not the fk_unit but the power of unit
644 644
 			$object->weight             	 = GETPOST('weight');
645 645
 			$object->weight_units       	 = GETPOST('weight_units'); // This is not the fk_unit but the power of unit
646 646
 			$object->length             	 = GETPOST('size');
@@ -783,10 +783,10 @@  discard block
 block discarded – undo
783 783
 		} else {
784 784
 			if ($object->id > 0) {
785 785
 				// Need dol_clone methode 1 (same object class) because update product use hasbatch() method on oldcopy
786
-				$object->oldcopy = dol_clone($object, 1);  // @phan-suppress-current-line PhanTypeMismatchProperty
786
+				$object->oldcopy = dol_clone($object, 1); // @phan-suppress-current-line PhanTypeMismatchProperty
787 787
 
788 788
 				if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) {
789
-					$object->ref                = (string) $ref;
789
+					$object->ref = (string) $ref;
790 790
 				}
791 791
 				$object->label                  = GETPOST('label', $label_security_check);
792 792
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 				$object->status_batch = GETPOSTINT('status_batch');
809 809
 				$object->sell_or_eat_by_mandatory = GETPOSTINT('sell_or_eat_by_mandatory');
810 810
 				$object->batch_mask = GETPOST('batch_mask', 'alpha');
811
-				$object->fk_default_warehouse   = GETPOSTINT('fk_default_warehouse');
811
+				$object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse');
812 812
 				$object->fk_default_workstation   = GETPOSTINT('fk_default_workstation');
813 813
 				// removed from update view so GETPOST always empty
814 814
 				/*
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 				}
849 849
 
850 850
 				// managed_in_stock
851
-				$object->stockable_product   = (int) GETPOSTISSET('stockable_product');
851
+				$object->stockable_product = (int) GETPOSTISSET('stockable_product');
852 852
 
853 853
 				$units = GETPOSTINT('units');
854 854
 				if ($units > 0) {
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 					$object->accountancy_code_buy_export = $accountancy_code_buy_export;
912 912
 				}
913 913
 				if ($object->isService()) {
914
-					$object->mandatory_period =  (!empty($checkmandatory)) ? 1 : 0 ;
914
+					$object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0;
915 915
 				}
916 916
 
917 917
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 							$action = "";
1047 1047
 
1048 1048
 							$mesg = $langs->trans("ErrorProductAlreadyExists", $clone->ref);
1049
-							$mesg .= ' <a href="' . $_SERVER["PHP_SELF"] . '?ref=' . $clone->ref . '">' . $langs->trans("ShowCardHere") . '</a>.';
1049
+							$mesg .= ' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$clone->ref.'">'.$langs->trans("ShowCardHere").'</a>.';
1050 1050
 							setEventMessages($mesg, null, 'errors');
1051 1051
 						} else {
1052 1052
 							setEventMessages(empty($clone->error) ? '' : $langs->trans($clone->error), $clone->errors, 'errors');
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 					} else {
1062 1062
 						$db->commit();
1063 1063
 						$db->close();
1064
-						header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
1064
+						header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
1065 1065
 						exit;
1066 1066
 					}
1067 1067
 				} else {
@@ -2254,9 +2254,9 @@  discard block
 block discarded – undo
2254 2254
 					if (isModEnabled('productbatch') && $object->hasbatch()) {
2255 2255
 						print '<tr><td><input type="hidden" id="stockable_product" name="stockable_product" value="on" /></td><td></td></tr>';
2256 2256
 					} else {
2257
-						print '<tr><td><label for="stockable_product">' . $langs->trans("StockableProduct") . '</label></td>';
2257
+						print '<tr><td><label for="stockable_product">'.$langs->trans("StockableProduct").'</label></td>';
2258 2258
 						$checked = empty($object->stockable_product) ? "" : "checked";
2259
-						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" '. $checked . ' /></td></tr>';
2259
+						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" '.$checked.' /></td></tr>';
2260 2260
 					}
2261 2261
 
2262 2262
 					// Default warehouse
@@ -2316,9 +2316,9 @@  discard block
 block discarded – undo
2316 2316
 					print '</td></tr>';
2317 2317
 
2318 2318
 					if (isModEnabled('stock') && getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
2319
-						print '<tr><td>' . $langs->trans("StockableProduct") . '</td>';
2319
+						print '<tr><td>'.$langs->trans("StockableProduct").'</td>';
2320 2320
 						$checked = $object->stockable_product == 1 ? "checked" : "";
2321
-						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" ' . $checked . ' /></td></tr>';
2321
+						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" '.$checked.' /></td></tr>';
2322 2322
 					}
2323 2323
 				} else {
2324 2324
 					if (!getDolGlobalString('PRODUCT_DISABLE_NATURE')) {
@@ -2799,7 +2799,7 @@  discard block
 block discarded – undo
2799 2799
 
2800 2800
 				// Stockable product / default warehouse
2801 2801
 				if (($object->isProduct() || getDolGlobalInt('STOCK_SUPPORTS_SERVICES')) && isModEnabled('stock')) {
2802
-					print '<tr><td>' . $form->textwithpicto($langs->trans("StockableProduct"), $langs->trans('StockableProductDescription')) . '</td>';
2802
+					print '<tr><td>'.$form->textwithpicto($langs->trans("StockableProduct"), $langs->trans('StockableProductDescription')).'</td>';
2803 2803
 					print '<td><input type="checkbox" readonly disabled '.($object->stockable_product == 1 ? 'checked' : '').'></td></tr>';
2804 2804
 
2805 2805
 					if ($object->isStockManaged()) {
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
 					$result = $measuringUnits->fetchAll('', 'scale', 0, 0, ['t.active' => 1, 't.unit_type' => 'time']);
2857 2857
 					if ($result !== -1) {
2858 2858
 						foreach ($measuringUnits->records as $record) {
2859
-							$durations[$record->short_label] = dol_ucfirst($record->label) . $plural;
2859
+							$durations[$record->short_label] = dol_ucfirst($record->label).$plural;
2860 2860
 						}
2861 2861
 					}
2862 2862
 					print '<tr><td class="titlefieldmiddle">'.$langs->trans("Duration").'</td><td>';
@@ -3097,7 +3097,7 @@  discard block
 block discarded – undo
3097 3097
 			}
3098 3098
 
3099 3099
 			//Send
3100
-			print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
3100
+			print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
3101 3101
 
3102 3102
 			if (!isset($hookmanager->resArray['no_button_copy']) || $hookmanager->resArray['no_button_copy'] != 1) {
3103 3103
 				if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
@@ -3279,7 +3279,7 @@  discard block
 block discarded – undo
3279 3279
 	$modelmail = 'product_send';
3280 3280
 	$defaulttopic = $object->label;
3281 3281
 	$diroutput = $conf->product->multidir_output[$object->entity];
3282
-	$trackid = 'prod' . $object->id;
3282
+	$trackid = 'prod'.$object->id;
3283 3283
 
3284 3284
 	include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
3285 3285
 }
Please login to merge, or discard this patch.