Browse Source

Fix usage of option STOCK_SUPPORTS_SERVICES

Laurent Destailleur 7 years ago
parent
commit
46b015d205

+ 6 - 3
htdocs/adherents/cartes/carte.php

@@ -269,7 +269,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
 {
 	$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
 }
-print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
+asort($arrayoflabels);
+print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
 print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
 print '</form>';
 print '<br>';
@@ -285,7 +286,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
 {
 	$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
 }
-print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
+asort($arrayoflabels);
+print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
 print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
 print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
 print '</form>';
@@ -302,7 +304,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
 {
 	$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
 }
-print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0);
+asort($arrayoflabels);
+print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
 print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
 print '</form>';
 print '<br>';

+ 8 - 8
htdocs/expedition/card.php

@@ -1259,7 +1259,7 @@ if ($action == 'create')
 					{
 						// Quantity to send
 						print '<td align="center">';
-						if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
+						if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
 						{
                             if (GETPOST('qtyl'.$indiceAsked, 'int')) $defaultqty=GETPOST('qtyl'.$indiceAsked, 'int');
                             print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
@@ -1272,7 +1272,7 @@ if ($action == 'create')
 						if (! empty($conf->stock->enabled))
 						{
 							print '<td align="left">';
-							if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))   // Type of product need stock change ?
+							if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))   // Type of product need stock change ?
 							{
 								// Show warehouse combo list
 								$ent = "entl".$indiceAsked;
@@ -1415,7 +1415,7 @@ if ($action == 'create')
 								// Quantity to send
 								print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'>';
 								print '<td colspan="3" ></td><td align="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.') -->';
-								if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
+								if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
 								{
 									print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
 									print '<input name="ent1'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$warehouse_id.'">';
@@ -1427,7 +1427,7 @@ if ($action == 'create')
 								if (! empty($conf->stock->enabled))
 								{
 									print '<td align="left">';
-									if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
+									if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
 									{
 										print $tmpwarehouseObject->getNomUrl(0).' ';
 
@@ -1542,7 +1542,7 @@ if ($action == 'create')
 					{
 					    print '<!-- line not shown yet, we show it -->';
 						print '<tr class="oddeven"><td colspan="3" ></td><td align="center">';
-						if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
+						if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
 						{
 						    $disabled='';
 					        if (! empty($conf->productbatch->enabled) && $product->hasbatch())
@@ -1558,7 +1558,7 @@ if ($action == 'create')
 						print '</td>';
 
 						print '<td align="left">';
-						if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
+						if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
 						{
 							$warehouse_selected_id = GETPOST('entrepot_id','int');
     						if ($warehouse_selected_id > 0)
@@ -2362,13 +2362,13 @@ else if ($id || $ref)
 
 			// Weight
 			print '<td align="center">';
-			if ($lines[$i]->fk_product_type == 0) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight");
+			if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight");
 			else print '&nbsp;';
 			print '</td>';
 
 			// Volume
 			print '<td align="center">';
-			if ($lines[$i]->fk_product_type == 0) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume");
+			if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume");
 			else print '&nbsp;';
 			print '</td>';
 

+ 5 - 1
htdocs/product/class/product.class.php

@@ -3468,7 +3468,11 @@ class Product extends CommonObject
     		if ($this->length)  $label.="<br><b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuring_units_string($this->length_units,'length');
     		if ($this->surface) $label.="<br><b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuring_units_string($this->surface_units,'surface');
     		if ($this->volume)  $label.="<br><b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuring_units_string($this->volume_units,'volume');
-            if (! empty($conf->productbatch->enabled))
+        }
+
+        if ($this->type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
+        {
+    		if (! empty($conf->productbatch->enabled))
             {
             	$langs->load("productbatch");
                 $label.="<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0,2);