--- /tmp/dsg/dolibarr/htdocs/bom/tpl/github_linkedobjectblock.tpl.php
+++ /tmp/dsg/dolibarr/htdocs/bom/tpl/client_linkedobjectblock.tpl.php
@@ -41,41 +41,34 @@
 $ilink = 0;

 foreach ($linkedObjectBlock as $key => $objectlink)

 {

-	$ilink++;

-	$product_static = new Product($db);

-	$trclass = 'oddeven';

-	if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';

-	echo '<tr class="'.$trclass.'" >';

-	echo '<td class="linkedcol-element" >'.$langs->trans("Bom");

-	if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {

-		print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'"  > <i class="fa fa-indent"></i> </a';

-	}

-	echo '</td>';

-	echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';

-

-	echo '<td class="linkedcol-ref" align="center">';

-	$result = $product_static->fetch($objectlink->fk_product);

-	if ($result < 0) {

-		setEventMessage($product_static->error, 'errors');

-	} elseif ($result > 0) {

-		$product_static->getNomUrl(1);

-	}

-	print '</td>';

-	echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_creation, 'day').'</td>';

-	echo '<td class="linkedcol-amount right">';

-	if ($user->rights->commande->lire) {

-		$total = $total + $objectlink->total_ht;

-		echo price($objectlink->total_ht);

-	}

-	echo '</td>';

-	echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';

-	echo '<td class="linkedcol-action right">';

-	// For now, shipments must stay linked to order, so link is not deletable

-	if ($object->element != 'shipping') {

-		echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';

-	}

-	echo '</td>';

-	echo "</tr>\n";

+    $ilink++;

+    $product_static = new Product($db);

+    $trclass = 'oddeven';

+    if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';

+    echo '<tr class="'.$trclass.'" >';

+    echo '<td class="linkedcol-element" >'.$langs->trans("Bom");

+    if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {

+        print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'"  > <i class="fa fa-indent"></i> </a';

+    }

+    echo '</td>';

+    echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';

+    $product_static->fetch($objectlink->fk_product);

+    echo '<td class="linkedcol-ref" align="center">'.$product_static->getNomUrl(1).'</td>';

+    echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_creation, 'day').'</td>';

+    echo '<td class="linkedcol-amount right">';

+    if ($user->rights->commande->lire) {

+        $total = $total + $objectlink->total_ht;

+        echo price($objectlink->total_ht);

+    }

+    echo '</td>';

+    echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';

+    echo '<td class="linkedcol-action right">';

+    // For now, shipments must stay linked to order, so link is not deletable

+    if ($object->element != 'shipping') {

+        echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';

+    }

+    echo '</td>';

+    echo "</tr>\n";

 }

 

 echo "<!-- END PHP TEMPLATE -->\n";

--- /tmp/dsg/dolibarr/htdocs/bom/tpl/github_objectline_create.tpl.php
+++ /tmp/dsg/dolibarr/htdocs/bom/tpl/client_objectline_create.tpl.php
@@ -31,8 +31,8 @@
 

 // Protection to avoid direct call of template

 if (empty($object) || !is_object($object)) {

-	print "Error: this template page cannot be called directly as an URL";

-	exit;

+    print "Error: this template page cannot be called directly as an URL";

+    exit;

 }

 

 

@@ -52,34 +52,35 @@
 

 $nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);

 if ($nolinesbefore) {

-	print '<tr class="liste_titre nodrag nodrop">';

-	if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {

-		print '<td class="linecolnum center"></td>';

-	}

-	print '<td class="linecoldescription minwidth500imp">';

+    print '<tr class="liste_titre nodrag nodrop">';

+    if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {

+        print '<td class="linecolnum center"></td>';

+    }

+    print '<td class="linecoldescription minwidth500imp">';

 	print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';

+	// echo $langs->trans("FreeZone");

 	print '</td>';

 	print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';

-	if (!empty($conf->global->PRODUCT_USE_UNITS))

+	if ($conf->global->PRODUCT_USE_UNITS)

 	{

-		print '<td class="linecoluseunit left">';

-		print '<span id="title_units">';

-		print $langs->trans('Unit');

-		print '</span></td>';

+	    print '<td class="linecoluseunit left">';

+	    print '<span id="title_units">';

+	    print $langs->trans('Unit');

+	    print '</span></td>';

 	}

 	print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';

 	print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';

 	print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';

 	print '<td class="linecoledit" colspan="'.$colspan.'">&nbsp;</td>';

-	print '</tr>';

+    print '</tr>';

 }

 print '<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create').'">';

 $coldisplay = 0;

 

 // Adds a line numbering column

 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {

-	$coldisplay++;

-	echo '<td class="bordertop nobottom linecolnum center"></td>';

+    $coldisplay++;

+    echo '<td class="bordertop nobottom linecolnum center"></td>';

 }

 

 $coldisplay++;

@@ -98,7 +99,9 @@
 	{

 		// hide products in closed warehouse, but show products for internal transfer

 		$form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));

-	} else {

+	}

+	else

+	{

 		$form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array'));

 	}

 

@@ -109,10 +112,11 @@
 print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';

 print '</td>';

 

-if (!empty($conf->global->PRODUCT_USE_UNITS))

+if ($conf->global->PRODUCT_USE_UNITS)

 {

-	$coldisplay++;

+    $coldisplay++;

 	print '<td class="nobottom linecoluseunit left">';

+	print $form->selectUnits($line->fk_unit, "units");

 	print '</td>';

 }

 

--- /tmp/dsg/dolibarr/htdocs/bom/tpl/github_objectline_edit.tpl.php
+++ /tmp/dsg/dolibarr/htdocs/bom/tpl/client_objectline_edit.tpl.php
@@ -82,8 +82,8 @@
 if (is_object($hookmanager))

 {

 	$fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);

-	$parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer);

-	$reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);

+    $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer);

+    $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);

 }

 

 print '</td>';

@@ -108,10 +108,11 @@
 }

 print '</td>';

 

-if (!empty($conf->global->PRODUCT_USE_UNITS))

+if ($conf->global->PRODUCT_USE_UNITS)

 {

-	$coldisplay++;

+    $coldisplay++;

 	print '<td class="nobottom linecoluseunit left">';

+	print $form->selectUnits($line->fk_unit, "units");

 	print '</td>';

 }

 

@@ -134,9 +135,9 @@
 $coldisplay += $colspan;

 print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';

 $coldisplay += $colspan;

-print '<input type="submit" class="button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'">';

+print '<input type="submit" class="button buttongen marginbottomonly" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'">';

 print '<br>';

-print '<input type="submit" class="button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';

+print '<input type="submit" class="button buttongen marginbottomonly" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';

 print '</td>';

 print '</tr>';

 

--- /tmp/dsg/dolibarr/htdocs/bom/tpl/github_objectline_title.tpl.php
+++ /tmp/dsg/dolibarr/htdocs/bom/tpl/client_objectline_title.tpl.php
@@ -54,7 +54,7 @@
 // Qty

 print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).'</td>';

 

-if (!empty($conf->global->PRODUCT_USE_UNITS))

+if ($conf->global->PRODUCT_USE_UNITS)

 {

 	print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';

 }

@@ -69,7 +69,7 @@
 print '<td class="linecolefficiency right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';

 

 // Cost

-print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td>';

+print '<td class="linecolcost right">'.$langs->trans('CostPrice').'</td>';

 

 print '<td class="linecoledit"></td>'; // No width to allow autodim

 

--- /tmp/dsg/dolibarr/htdocs/bom/tpl/github_objectline_view.tpl.php
+++ /tmp/dsg/dolibarr/htdocs/bom/tpl/client_objectline_view.tpl.php
@@ -79,10 +79,10 @@
 echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price

 print '</td>';

 

-if (!empty($conf->global->PRODUCT_USE_UNITS))

+if ($conf->global->PRODUCT_USE_UNITS)

 {

 	print '<td class="linecoluseunit nowrap left">';

-	$label = $tmpproduct->getLabelOfUnit('long');

+	$label = $line->getLabelOfUnit('short');

 	if ($label !== '') {

 		print $langs->trans($label);

 	}

@@ -111,21 +111,21 @@
 if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {

 	print '<td class="linecoledit center">';

 	$coldisplay++;

-	if (($line->info_bits & 2) == 2 || !empty($disableedit)) {

-	} else {

-		print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'">'.img_edit().'</a>';

-	}

-	print '</td>';

+    if (($line->info_bits & 2) == 2 || !empty($disableedit)) {

+    } else {

+        print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">'.img_edit().'</a>';

+    }

+    print '</td>';

 

-	print '<td class="linecoldelete center">';

-	$coldisplay++;

-	if (($line->fk_prev_id == null) && empty($disableremove)) {

-		//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation

-		print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=deleteline&amp;token='.newToken().'&amp;lineid='.$line->id.'">';

-		print img_delete();

-		print '</a>';

-	}

-	print '</td>';

+    print '<td class="linecoldelete center">';

+    $coldisplay++;

+    if (($line->fk_prev_id == null) && empty($disableremove)) {

+        //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation

+        print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=deleteline&amp;lineid='.$line->id.'">';

+        print img_delete();

+        print '</a>';

+    }

+    print '</td>';

 

 	if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {

 		print '<td class="linecolmove tdlineupdown center">';

@@ -146,14 +146,14 @@
 		$coldisplay++;

 	}

 } else {

-	print '<td colspan="3"></td>';

-	$coldisplay = $coldisplay + 3;

+    print '<td colspan="3"></td>';

+    $coldisplay = $coldisplay + 3;

 }

 

 if ($action == 'selectlines') {

-	print '<td class="linecolcheck center">';

-	print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';

-	print '</td>';

+    print '<td class="linecolcheck center">';

+    print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';

+    print '</td>';

 }

 

 print '</tr>';