Completed
Branch develop (fde605)
by
unknown
25:27
created
htdocs/expedition/class/expedition.class.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		if (getDolGlobalString('EXPEDITION_ADDON_NUMBER')) {
370 370
 			$mybool = false;
371 371
 
372
-			$file = getDolGlobalString('EXPEDITION_ADDON_NUMBER') . ".php";
372
+			$file = getDolGlobalString('EXPEDITION_ADDON_NUMBER').".php";
373 373
 			$classname = getDolGlobalString('EXPEDITION_ADDON_NUMBER');
374 374
 
375 375
 			// Include file with class
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 									$line_id = $this->create_line($warehouse_id, 0, $product_child_qty, $line->rang, $line->array_options, $parent_line_id, $product_child_id);
633 633
 									if ($line_id <= 0) {
634 634
 										$error++;
635
-										dol_syslog(__METHOD__ . ' : ' . $this->errorsToString(), LOG_ERR);
635
+										dol_syslog(__METHOD__.' : '.$this->errorsToString(), LOG_ERR);
636 636
 										break;
637 637
 									}
638 638
 
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 				$this->ref_ext = $obj->ref_ext;
868 868
 				$this->status               = $obj->fk_statut;
869 869
 				$this->statut               = $this->status; // Deprecated
870
-				$this->signed_status		= $obj->signed_status;
870
+				$this->signed_status = $obj->signed_status;
871 871
 				$this->user_author_id       = $obj->fk_user_author;
872 872
 				$this->fk_user_author       = $obj->fk_user_author;
873 873
 				$this->user_creation_id = $obj->fk_user_author;
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 		// If product need a batch number, we should not have called this function but addline_batch instead.
1245 1245
 		// If this happen, we may have a bug in card.php page
1246 1246
 		if (isModEnabled('productbatch') && !empty($line->fk_product) && !empty($orderline->product_tobatch)) {
1247
-			$this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH '.$orderline->id.' '.$line->fk_product;	//
1247
+			$this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH '.$orderline->id.' '.$line->fk_product; //
1248 1248
 			return -4;
1249 1249
 		}
1250 1250
 
@@ -1867,14 +1867,14 @@  discard block
 block discarded – undo
1867 1867
 					$this->db->commit();
1868 1868
 
1869 1869
 					// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
1870
-					$this->deleteEcmFiles(0);	 // Deleting files physically is done later with the dol_delete_dir_recursive
1871
-					$this->deleteEcmFiles(1);	 // Deleting files physically is done later with the dol_delete_dir_recursive
1870
+					$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
1871
+					$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
1872 1872
 
1873 1873
 					// We delete PDFs
1874 1874
 					$ref = dol_sanitizeFileName($this->ref);
1875 1875
 					if (!empty($conf->expedition->dir_output)) {
1876
-						$dir = $conf->expedition->dir_output . '/sending/' . $ref;
1877
-						$file = $dir . '/' . $ref . '.pdf';
1876
+						$dir = $conf->expedition->dir_output.'/sending/'.$ref;
1877
+						$file = $dir.'/'.$ref.'.pdf';
1878 1878
 						if (file_exists($file)) {
1879 1879
 							if (!dol_delete_file($file)) {
1880 1880
 								return 0;
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
 		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
1935 1935
 		$sql .= " WHERE ed.fk_expedition = ".((int) $this->id);
1936 1936
 		$sql .= " AND ed.fk_elementdet = cd.rowid";
1937
-		$sql .= " ORDER BY cd.rang, ed.fk_elementdet";		// We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria.
1937
+		$sql .= " ORDER BY cd.rang, ed.fk_elementdet"; // We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria.
1938 1938
 
1939 1939
 		dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
1940 1940
 		$resql = $this->db->query($sql);
@@ -1968,9 +1968,9 @@  discard block
 block discarded – undo
1968 1968
 					$line->entrepot_id = 0; // entrepod_id in details_entrepot
1969 1969
 					$line->qty_shipped += $obj->qty_shipped;
1970 1970
 				} else {
1971
-					$line = new ExpeditionLigne($this->db);		// new group to start
1972
-					$line->entrepot_id = $obj->fk_entrepot;	// this is a property of a shipment line
1973
-					$line->qty_shipped = $obj->qty_shipped;	// this is a property of a shipment line
1971
+					$line = new ExpeditionLigne($this->db); // new group to start
1972
+					$line->entrepot_id = $obj->fk_entrepot; // this is a property of a shipment line
1973
+					$line->qty_shipped = $obj->qty_shipped; // this is a property of a shipment line
1974 1974
 				}
1975 1975
 
1976 1976
 				$detail_entrepot              = new stdClass();
@@ -1983,13 +1983,13 @@  discard block
 block discarded – undo
1983 1983
 				$line->rowid            = $obj->line_id; // TODO deprecated
1984 1984
 				$line->id               = $obj->line_id;
1985 1985
 
1986
-				$line->fk_origin = 'orderline';	// TODO deprecated, we already have element_type that can be use to guess type of line
1986
+				$line->fk_origin = 'orderline'; // TODO deprecated, we already have element_type that can be use to guess type of line
1987 1987
 
1988
-				$line->fk_element 		= $obj->fk_element;
1989
-				$line->origin_id 		= $obj->fk_element;
1990
-				$line->fk_elementdet 	= $obj->fk_elementdet;
1991
-				$line->origin_line_id 	= $obj->fk_elementdet;
1992
-				$line->element_type 	= $obj->element_type;
1988
+				$line->fk_element = $obj->fk_element;
1989
+				$line->origin_id = $obj->fk_element;
1990
+				$line->fk_elementdet = $obj->fk_elementdet;
1991
+				$line->origin_line_id = $obj->fk_elementdet;
1992
+				$line->element_type = $obj->element_type;
1993 1993
 
1994 1994
 				$line->fk_expedition    = $this->id; // id of parent
1995 1995
 
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 		}
2284 2284
 		$result .= $linkend;
2285 2285
 		global $action;
2286
-		$hookmanager->initHooks(array($this->element . 'dao'));
2286
+		$hookmanager->initHooks(array($this->element.'dao'));
2287 2287
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
2288 2288
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
2289 2289
 		if ($reshook > 0) {
@@ -2332,9 +2332,9 @@  discard block
 block discarded – undo
2332 2332
 			$statusType = 'status9';
2333 2333
 		}
2334 2334
 
2335
-		$signed_label = ' (' . $this->getLibSignedStatus() . ')';
2336
-		$status_label = $this->signed_status ? $labelStatus . $signed_label : $labelStatus;
2337
-		$status_label_short = $this->signed_status ? $labelStatusShort . $signed_label : $labelStatusShort;
2335
+		$signed_label = ' ('.$this->getLibSignedStatus().')';
2336
+		$status_label = $this->signed_status ? $labelStatus.$signed_label : $labelStatus;
2337
+		$status_label_short = $this->signed_status ? $labelStatusShort.$signed_label : $labelStatusShort;
2338 2338
 
2339 2339
 		return dolGetStatus($status_label, $status_label_short, '', $statusType, $mode);
2340 2340
 	}
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
 		$return .= img_picto('', 'order');
2359 2359
 		$return .= '</div>';
2360 2360
 		$return .= '<div class="info-box-content">';
2361
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl() . '</span>';
2361
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.$this->getNomUrl().'</span>';
2362 2362
 		if ($selected >= 0) {
2363 2363
 			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2364 2364
 		}
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
 		$this->note_private = 'Private note';
2416 2416
 		$this->note_public = 'Public note';
2417 2417
 
2418
-		$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5);	// We can force the nb of lines to test from command line (but not more than 1000)
2418
+		$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000)
2419 2419
 		$xnbp = 0;
2420 2420
 		while ($xnbp < $nbp) {
2421 2421
 			$line = new ExpeditionLigne($this->db);
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 			$line->fk_product = $this->commande->lines[$xnbp]->fk_product;
2428 2428
 
2429 2429
 			$line->weight = 1.123456;
2430
-			$line->weight_units = 0;		// kg
2430
+			$line->weight_units = 0; // kg
2431 2431
 
2432 2432
 			$line->volume = 2.34567;
2433 2433
 			$line->volume_unit = 0;
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
 		if ($resql) {
2562 2562
 			while ($obj = $this->db->fetch_object($resql)) {
2563 2563
 				$label = $langs->trans('SendingMethod'.$obj->code);
2564
-				$this->listmeths[$i]= [
2564
+				$this->listmeths[$i] = [
2565 2565
 					'rowid' => (int) $obj->rowid,
2566 2566
 					'code' => $obj->code,
2567 2567
 					'libelle' => ($label != 'SendingMethod'.$obj->code ? $label : $obj->label),
@@ -2651,12 +2651,12 @@  discard block
 block discarded – undo
2651 2651
 				if ($shipments_match_order) {
2652 2652
 					dol_syslog("Qty for the ".count($order->lines)." lines of the origin order is same than qty for lines in the shipment we close (shipments_match_order is true), with new status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order');
2653 2653
 					// We close the order
2654
-					$order->cloture($user);		// Note this may also create an invoice if module workflow ask it
2654
+					$order->cloture($user); // Note this may also create an invoice if module workflow ask it
2655 2655
 				}
2656 2656
 			}
2657 2657
 
2658
-			$this->statut = self::STATUS_CLOSED;	// Will be revert to STATUS_VALIDATED at end if there is a rollback
2659
-			$this->status = self::STATUS_CLOSED;	// Will be revert to STATUS_VALIDATED at end if there is a rollback
2658
+			$this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback
2659
+			$this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback
2660 2660
 
2661 2661
 			// If stock increment is done on closing
2662 2662
 			if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) {
@@ -2704,7 +2704,7 @@  discard block
 block discarded – undo
2704 2704
 
2705 2705
 		$error = 0;
2706 2706
 
2707
-		require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php';
2707
+		require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
2708 2708
 
2709 2709
 		$langs->load("agenda");
2710 2710
 
@@ -2715,14 +2715,14 @@  discard block
 block discarded – undo
2715 2715
 		$sql .= ", cd.subprice";
2716 2716
 		$sql .= ", edb.rowid as edbrowid, edb.eatby, edb.sellby, edb.batch, edb.qty as edbqty, edb.fk_origin_stock";
2717 2717
 		$sql .= ", e.ref";
2718
-		$sql .= " FROM " . $this->db->prefix() . "expeditiondet as ed";
2719
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "commandedet as cd ON cd.rowid = ed.fk_elementdet";
2720
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid";
2721
-		$sql .= " INNER JOIN " . $this->db->prefix() . "expedition as e ON ed.fk_expedition = e.rowid";
2722
-		$sql .= " WHERE ed.fk_expedition = " . ((int) $this->id);
2718
+		$sql .= " FROM ".$this->db->prefix()."expeditiondet as ed";
2719
+		$sql .= " LEFT JOIN ".$this->db->prefix()."commandedet as cd ON cd.rowid = ed.fk_elementdet";
2720
+		$sql .= " LEFT JOIN ".$this->db->prefix()."expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid";
2721
+		$sql .= " INNER JOIN ".$this->db->prefix()."expedition as e ON ed.fk_expedition = e.rowid";
2722
+		$sql .= " WHERE ed.fk_expedition = ".((int) $this->id);
2723 2723
 		//$sql .= " AND cd.rowid = ed.fk_elementdet";
2724 2724
 
2725
-		dol_syslog(get_class($this) . "::valid select details", LOG_DEBUG);
2725
+		dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
2726 2726
 		$resql = $this->db->query($sql);
2727 2727
 		if ($resql) {
2728 2728
 			$cpt = $this->db->num_rows($resql);
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
 				if ($qty <= 0 || ($qty < 0 && !getDolGlobalInt('SHIPMENT_ALLOW_NEGATIVE_QTY'))) {
2737 2737
 					continue;
2738 2738
 				}
2739
-				dol_syslog(get_class($this) . "::valid movement index " . $i . " ed.rowid=" . $obj->edid . " edb.rowid=" . $obj->edbrowid);
2739
+				dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->edid." edb.rowid=".$obj->edbrowid);
2740 2740
 
2741 2741
 				$mouvS = new MouvementStock($this->db);
2742 2742
 				$mouvS->origin = &$this;
Please login to merge, or discard this patch.