';
+ }
+ if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
+ // Qty frozen
print '
';
+}
+if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
+ // Qty frozen
$coldisplay++;
print '
';
+}
+if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
// Qty frozen
print '
';
-
+// Service and workstations are active
+if ($filtertype == 1 && isModEnabled('workstation')) {
// Workstation
if (isModEnabled('workstation')) {
print '
'; // No width to allow autodim
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 1eb5af994551a..310466465ab8f 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -139,7 +139,7 @@
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formatting role of function price
print '';
-if ($filtertype != 1) {
+if ($filtertype != 1) { // Product
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // For product, unit is shown only if option PRODUCT_USE_UNITS is on
print '
';
- $coldisplay++;
- echo $line->disable_stock_change ? yn($line->disable_stock_change) : ''; // Yes, it is a quantity, not a price, but we just want the formatting role of function price
- print '
';
-} else {
+} else { // Service
// Unit // For services, units are always enabled
print '
';
$coldisplay++;
@@ -175,25 +161,38 @@
}
print '
';
-
+}
+if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
// Qty frozen
print '
';
- // Work station
- if (isModEnabled('workstation')) {
- $workstation = new Workstation($object->db);
- $res = $workstation->fetch($line->fk_default_workstation);
+ // Disable stock change
+ print '
';
+ $coldisplay++;
+ echo $line->disable_stock_change ? yn($line->disable_stock_change) : ''; // Yes, it is a quantity, not a price, but we just want the formatting role of function price
+ print '
';
}
// Cost
diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
index 3cbaeba0e4777..e096fe540796a 100644
--- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
@@ -1356,12 +1356,12 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
// If CUSTOMER contact defined, we use it
$usecontact = false;
- if (getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
+ if (!getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
} else {
$arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING'));
}
- if (count($arrayidcontact) > 0) {
+ if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
}
diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php
index 9a8917bd59d95..2bb692dd00ec5 100644
--- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php
@@ -1304,7 +1304,8 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
// Get contact
if (getDolGlobalString('DOC_SHOW_FIRST_SALES_REP')) {
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
- if (count($arrayidcontact) > 0) {
+
+ if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
$usertmp = new User($this->db);
$usertmp->fetch($arrayidcontact[0]);
$posy += 4;
@@ -1377,12 +1378,12 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
// If CUSTOMER contact defined on proposal, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER'
$usecontact = false;
- if (getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
+ if (!getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
} else {
$arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING'));
}
- if (count($arrayidcontact) > 0) {
+ if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
}
diff --git a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php
index 0f5b2c4e9f733..f487e0dce9169 100644
--- a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php
+++ b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php
@@ -446,6 +446,7 @@ public function __invoke($className)
if (false !== $includeReference = $this->discover($className))
return $includeReference;
+ // @CHANGE LDR Reduce cases of conflicts with the messy autoload
//static::thereCanBeOnlyOne();
if (false !== $includeReference = $this->loadAliases($className))
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 181be73bd04ca..c3d80ca51b6a1 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2389,8 +2389,8 @@ INVOICE_ADD_EPC_QR_CODEMore=This feature allows you to add or remove an EPC QR C
INVOICE_ADD_EPC_QR_CODEPay=Scan this QR code to pay with a smartphone supporting payment with EPC QR code.
INVOICE_SHOW_SHIPPING_ADDRESS=Show shipping address
INVOICE_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...)
-SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT = Show billing contact on proposal
-SUPPLIER_PROPOSAL_ADD_BILLING_CONTACMore = By default the contact only appears for billing
+SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT=Show billing contact on proposal
+SUPPLIER_PROPOSAL_ADD_BILLING_CONTACTMore=By default the contact only appears for billing
UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
IfThisCategoryIsChildOfAnother=If this category is a child of another one
DarkThemeMode=Dark theme mode
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 568bd5f47fc1f..0fa4bc719ccc3 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1525,7 +1525,7 @@ public function delete(User $user, $notrigger = 0)
$this->error = "Object must be fetched before calling delete";
return -1;
}
- if (($this->type == Product::TYPE_PRODUCT && !$user->hasRight('produit', 'supprimer')) || ($this->type == Product::TYPE_SERVICE && !$user->hasRight('service', 'supprimer'))) {
+ if (($this->isProduct() && !$user->hasRight('produit', 'supprimer')) || ($this->isService() && !$user->hasRight('service', 'supprimer'))) {
$this->error = "ErrorForbidden";
return 0;
}
@@ -5335,9 +5335,9 @@ public function getTooltipContentArray($params)
}
}
- if ($this->type == Product::TYPE_PRODUCT) {
+ if ($this->isProduct()) {
$datas['picto'] = img_picto('', 'product').' '.$langs->trans("Product").'';
- } elseif ($this->type == Product::TYPE_SERVICE) {
+ } elseif ($this->isService()) {
$datas['picto'] = img_picto('', 'service').' '.$langs->trans("Service").'';
}
if (isset($this->status) && isset($this->status_buy)) {
@@ -5353,7 +5353,7 @@ public function getTooltipContentArray($params)
if (!empty($this->description)) {
$datas['description'] = ' '.$langs->trans('ProductDescription').': '.dolGetFirstLineOfText($this->description, 5);
}
- if ($this->type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
+ if ($this->isStockManaged()) {
if (isModEnabled('productbatch')) {
$langs->load("productbatch");
$datas['batchstatus'] = " ".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2);
@@ -5363,7 +5363,7 @@ public function getTooltipContentArray($params)
$datas['barcode'] = ' '.$langs->trans('BarCode').': '.$this->barcode;
}
- if ($this->type == Product::TYPE_PRODUCT) {
+ if ($this->isProduct()) {
if ($this->weight) {
$datas['weight'] = " ".$langs->trans("Weight").': '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units);
}
@@ -5392,7 +5392,7 @@ public function getTooltipContentArray($params)
$datas['surface'] = " " . $labelsurfacevolume;
}
}
- if ($this->type == Product::TYPE_SERVICE && !empty($this->duration_value)) {
+ if ($this->isService() && !empty($this->duration_value)) {
// Duration
$datas['duration'] = ' '.$langs->trans("Duration").': '.$this->duration_value;
if ($this->duration_value > 1) {
@@ -5518,10 +5518,10 @@ public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $save_la
$result .= $linkstart;
if ($withpicto) {
- if ($this->type == Product::TYPE_PRODUCT) {
+ if ($this->isProduct()) {
$result .= (img_object(($notooltip ? '' : $label), 'product', 'class="paddingright"', 0, 0, $notooltip ? 0 : 1));
}
- if ($this->type == Product::TYPE_SERVICE) {
+ if ($this->isService()) {
$result .= (img_object(($notooltip ? '' : $label), 'service', 'class="paddingright"', 0, 0, $notooltip ? 0 : 1));
}
}
@@ -6318,29 +6318,29 @@ public function loadStateBoard()
}
/**
- * Return if object is a product.
+ * Return if the object is a product.
*
- * @return boolean True if it's a product
+ * @return boolean True if the object is a product, false otherwise.
*/
public function isProduct()
{
- return ($this->type == Product::TYPE_PRODUCT ? true : false);
+ return $this->type == Product::TYPE_PRODUCT;
}
/**
- * Return if object is a product
+ * Return if the object is a service.
*
- * @return boolean True if it's a service
+ * @return boolean True if the object is a service, false otherwise.
*/
public function isService()
{
- return ($this->type == Product::TYPE_SERVICE ? true : false);
+ return $this->type == Product::TYPE_SERVICE;
}
/**
- * Return if object need to have its stock managed
+ * Return if the object is managed in stock.
*
- * @return boolean True if it's a service
+ * @return boolean True if the object is managed in stock, false otherwise.
*/
public function isStockManaged()
{
@@ -6348,23 +6348,23 @@ public function isStockManaged()
}
/**
- * Return if object have a constraint on mandatory_period
+ * Return if the object has a constraint on mandatory_period
*
- * @return boolean True if mandatory_period set to 1
+ * @return boolean True if mandatory_period is set to 1, false otherwise.
*/
public function isMandatoryPeriod()
{
- return ($this->mandatory_period == 1 ? true : false);
+ return $this->mandatory_period == 1;
}
/**
- * Return if object has a sell-by date or eat-by date
+ * Return if the object has a sell-by or eat-by date.
*
- * @return boolean True if it's has
+ * @return boolean True if the object has a sell-by or eat-by date, false otherwise.
*/
public function hasbatch()
{
- return ($this->status_batch > 0 ? true : false);
+ return $this->status_batch > 0;
}
@@ -6726,9 +6726,9 @@ public function getKanbanView($option = '', $arraydata = null)
$label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 120, 160, 0, 0, 0, '', 'photoref photokanban');
$return .= $label;
} else {
- if ($this->type == Product::TYPE_PRODUCT) {
+ if ($this->isProduct()) {
$label .= img_picto('', 'product');
- } elseif ($this->type == Product::TYPE_SERVICE) {
+ } elseif ($this->isService()) {
$label .= img_picto('', 'service');
}
$return .= $label;