diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index a13b1cf7b8e59..8862a524b6114 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -330,7 +330,7 @@ } print ''; */ - + print ''; print ''; } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 011666eb6abee..a099d93305791 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -77,25 +77,33 @@ print ''; print ''.$langs->trans('Qty').''; - if ($filtertype != 1) { + if ($filtertype != 1) { // Product if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; print ''; print $langs->trans('Unit'); print ''; } + } else { // Service + print '' . $form->textwithpicto($langs->trans('Unit'), '').''; + } + if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active + // Qty frozen print '' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ''; + + // Disable stock change print '' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . ''; + + // Efficiency print '' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . ''; - } else { - print '' . $form->textwithpicto($langs->trans('Unit'), '').''; - print '' .$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ''; + } - if (isModEnabled('workstation')) { - print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ''; - } - print '' . $form->textwithpicto($langs->trans('TotalCost'), '') . ''; + // Service and workstations are active + if ($filtertype == 1 && isModEnabled('workstation')) { + print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ''; } + // Cost + print '' . $form->textwithpicto($langs->trans('TotalCost'), '') . ''; print ' '; print ''; @@ -154,32 +162,13 @@ print ''; print ''; -if ($filtertype != 1) { +if ($filtertype != 1) { // Product if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $coldisplay++; print ''; print ''; } - - $coldisplay++; - print ''; - print ''; - - - $coldisplay++; - print ''; - print ''; - - $coldisplay++; - print ''; - print ''; - print ''; - - $coldisplay++; - print ''; - print ' '; - print ''; -} else { +} else { // Service $coldisplay++; require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; $cUnit = new CUnits($this->db); @@ -187,22 +176,39 @@ print ''; print $formproduct->selectMeasuringUnits("fk_unit", "time", $fk_unit_default, 1); print ''; - +} +if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active + // Qty frozen $coldisplay++; print ''; print ''; + // Disable stock change $coldisplay++; - print ''; - print $formproduct->selectWorkstations('', 'idworkstations', 1); + print ''; print ''; + // Efficiency + $coldisplay++; + print ''; + print ''; + print ''; +} +// Service and workstations are active +if ($filtertype == 1 && isModEnabled('workstation')) { $coldisplay++; - print ''; - print ' '; + print ''; + print $formproduct->selectWorkstations('', 'idworkstations', 1); print ''; } +// Cost +$coldisplay++; +print ''; +print ' '; +print ''; + + $coldisplay += $colspan; print ''; print ''; diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 8394cb4c0ad4b..dbff055c049e4 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -130,48 +130,47 @@ } print ''; -if ($filtertype != 1) { +if ($filtertype != 1) { // Product if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $coldisplay++; print ''; print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0); print ''; } - +} else { // Service + $coldisplay++; + print ''; + print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0); + print ''; +} +if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active + // Qty frozen $coldisplay++; print 'qty_frozen ? ' checked="checked"' : '')) . '>'; print ''; + // Disable stock change $coldisplay++; print 'disable_stock_change ? ' checked="checked"' : '')) . '">'; print ''; + // Efficiency $coldisplay++; print ''; print ''; +} - $coldisplay++; - print ''; - print ''; -} else { - $coldisplay++; - print ''; - print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0); - print ''; - - $coldisplay++; - print 'qty_frozen ? ' checked="checked"' : '')) . '>'; - print ''; - +// Service and workstations are active +if ($filtertype == 1 && isModEnabled('workstation')) { $coldisplay++; print ''; print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1); print ''; - - $coldisplay++; - print ''; - print ''; } +// Cost +$coldisplay++; +print ''; +print ''; $coldisplay += $colspan; print ''; diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index a357628eba0f1..70dd5e95a95ef 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -71,11 +71,14 @@ // Qty print ''.$form->textwithpicto($langs->trans('Qty'), ($filtertype != 1) ? $langs->trans("QtyRequiredIfNoLoss") : '').''; -if ($filtertype != 1) { +if ($filtertype != 1) { // Product if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } - +} else { // Service + print ''; +} +if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active // Qty frozen print '' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ''; @@ -84,26 +87,18 @@ // Efficiency print '' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . ''; +} - // Cost - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''; -} else { - print ''; - - // Qty frozen - print '' .$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ''; - +// Service and workstations are active +if ($filtertype == 1 && isModEnabled('workstation')) { // Workstation if (isModEnabled('workstation')) { print '' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . ''; } - - // Cost - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCostService")).''; } - - +// Cost +print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''; 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 ''; $label = measuringUnitString($line->fk_unit, '', '', 1); @@ -148,21 +148,7 @@ } print ''; } - - print ''; - $coldisplay++; - echo $line->qty_frozen ? yn($line->qty_frozen) : ''; - print ''; - 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 ''; - - print ''; - $coldisplay++; - echo $line->efficiency; - 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 ''; $coldisplay++; echo $line->qty_frozen ? yn($line->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 ''; - print ''; - $coldisplay++; - if ($res > 0) { - echo $workstation->getNomUrl(1); - } - print ''; + // Efficiency + print ''; + $coldisplay++; + echo $line->efficiency; + print ''; +} + +// Service and workstations are active +if ($filtertype == 1 && isModEnabled('workstation')) { + $workstation = new Workstation($object->db); + $res = $workstation->fetch($line->fk_default_workstation); + + print ''; + $coldisplay++; + if ($res > 0) { + echo $workstation->getNomUrl(1); } + 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;