diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 7c7eecc84f0..b6e30f65454 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -161,7 +161,7 @@ if (!empty($triggers)) { $module = 'fournisseur'; } if ($module == 'shipping') { - $module = 'expedition_bon'; + $module = 'expedition'; } if ($module == 'member') { $module = 'adherent'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 318ce32f115..1f34fbd18a9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2888,7 +2888,7 @@ if ($action == 'create' && $usercancreate) { $numshipping = $object->countNbOfShipments(); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { - if ((isModEnabled('expedition_bon') && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) { + if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) { if ($user->hasRight('expedition', 'creer')) { print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, ''); } else { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d411321386b..1c3481fb1f6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4142,7 +4142,7 @@ abstract class CommonObject } elseif ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; - $module = 'expedition_bon'; + $module = 'expedition'; } elseif ($objecttype == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 410ecfe7399..855b8aae2a9 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -522,13 +522,6 @@ class Conf // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. - // Sous module bons d'expedition - $this->expedition_bon = new stdClass(); - $this->expedition_bon->enabled = (empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? 0 : $this->global->MAIN_SUBMODULE_EXPEDITION); - // Sub module delivery note Sous module bons de livraison - $this->delivery_note = new stdClass(); - $this->delivery_note->enabled = (empty($this->global->MAIN_SUBMODULE_DELIVERY) ? 0 : $this->global->MAIN_SUBMODULE_DELIVERY); - // Module fournisseur if (!empty($this->fournisseur)) { $this->fournisseur->commande = new stdClass(); diff --git a/htdocs/core/lib/expedition.lib.php b/htdocs/core/lib/expedition.lib.php index 21076122903..ea692fc2ab7 100644 --- a/htdocs/core/lib/expedition.lib.php +++ b/htdocs/core/lib/expedition.lib.php @@ -53,7 +53,7 @@ function expedition_prepare_head(Expedition $object) $hselected = $h; $h++; - if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php"; $head[$h][1] = $langs->trans("Receivings"); $h++; @@ -121,7 +121,7 @@ function expedition_admin_prepare_head() $head[$h][2] = 'receivings'; $h++; - if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { $extrafields->fetch_name_optionals_label('delivery'); $extrafields->fetch_name_optionals_label('deliverydet'); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index cb5a2247953..8368df4496e 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -60,28 +60,28 @@ function commande_prepare_head(Commande $object) $h++; } - if ((isModEnabled('expedition_bon') && $user->hasRight('expedition', 'lire')) - || (isModEnabled('delivery_note') && $user->hasRight('expedition', 'delivery', 'lire'))) { + if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'lire')) + || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'lire'))) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; - if (isModEnabled('expedition_bon')) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { $text .= $langs->trans("Shipments"); } - if (isModEnabled('expedition_bon') && isModEnabled('delivery_note')) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { $text .= ' - '; } - if (isModEnabled('delivery_note')) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { $text .= $langs->trans("Receivings"); } if ($nbShipments > 0 || $nbReceiption > 0) { $text .= ''.($nbShipments ? $nbShipments : 0); } - if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ' - '; } - if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ($nbReceiption ? $nbReceiption : 0); } if ($nbShipments > 0 || $nbReceiption > 0) { diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 588418c7449..b24fec85a9c 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -42,16 +42,19 @@ function propal_prepare_head($object) $head[$h][2] = 'comm'; $h++; - if ((empty($conf->commande->enabled) && ((isModEnabled("expedition") && isModEnabled('expedition_bon') && $user->rights->expedition->lire) - || (isModEnabled("expedition") && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire)))) { + if ((empty($conf->commande->enabled) && ((isModEnabled("expedition") && getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->rights->expedition->lire) + || (isModEnabled("expedition") && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->rights->expedition->delivery->lire)))) { $langs->load("sendings"); $text = ''; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; - if (isModEnabled('expedition_bon')) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { $text = $langs->trans("Shipment"); } - if (isModEnabled('delivery_note')) { - $text .= '/'.$langs->trans("Receivings"); + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { + $text .= '/'; + } + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { + $text .= $langs->trans("Receivings"); } $head[$h][1] = $text; $head[$h][2] = 'shipping'; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 4013c6d41e9..cfbed82f9d3 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -47,7 +47,7 @@ function shipping_prepare_head($object) $head[$h][2] = 'shipping'; $h++; - if ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->rights->expedition->delivery->lire) { // delivery link $object->fetchObjectLinked($object->id, $object->element); if (isset($object->linkedObjectsIds['delivery']) && is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) { // If there is a delivery @@ -133,7 +133,7 @@ function delivery_prepare_head($object) $h = 0; $head = array(); - if (isModEnabled('expedition_bon') && $user->rights->expedition->lire) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->rights->expedition->lire) { $head[$h][0] = DOL_URL_ROOT."/expedition/card.php?id=".$object->origin_id; $head[$h][1] = $langs->trans("SendingCard"); $head[$h][2] = 'shipping'; @@ -236,13 +236,13 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,"; $sql .= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; - //if ($conf->delivery_note->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; + //if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; $sql .= ' p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; //TODO Add link to expeditiondet_batch $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; @@ -285,7 +285,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''; print ''; }*/ - if (!empty($conf->delivery_note->enabled)) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { print ''.$langs->trans("DeliveryOrder").''; //print ''.$langs->trans("QtyReceived").''; print ''.$langs->trans("DeliveryDate").''; @@ -427,7 +427,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') }*/ // Informations on receipt - if (!empty($conf->delivery_note->enabled)) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; $expedition->id = $objp->sendingid; $expedition->fetchObjectLinked($expedition->id, $expedition->element); diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index ea345efadcb..abed76cff93 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if (isModEnabled("product") || isModEnabled("service")) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; } -if (isModEnabled('expedition_bon')) { +if (isModEnabled('expedition')) { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; } if (isModEnabled('stock')) { @@ -104,9 +104,10 @@ if ($action == 'add') { $object->commande_id = GETPOST("commande_id", 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - if (!isModEnabled('expedition_bon') && isModEnabled('stock')) { - $expedition->entrepot_id = GETPOST('entrepot_id', 'int'); - } + /* ->entrepot_id seems to not exists + if (!getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && isModEnabled('stock')) { + $object->entrepot_id = GETPOST('entrepot_id', 'int'); + }*/ // We loop on each line of order to complete object delivery with qty to delivery $commande = new Commande($db); @@ -479,10 +480,11 @@ if ($action == 'create') { print ''.$object->getLibStatut(4)."\n"; print '';*/ - if (!isModEnabled('expedition_bon') && isModEnabled('stock')) { + + if (!getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && isModEnabled('stock')) { // Entrepot $entrepot = new Entrepot($db); - $entrepot->fetch($object->entrepot_id); + $entrepot->fetch($expedition->entrepot_id); print ''.$langs->trans("Warehouse").''; print ''.$entrepot->label.''; print ''; @@ -647,7 +649,7 @@ if ($action == 'create') { } if ($user->rights->expedition->delivery->supprimer) { - if (isModEnabled('expedition_bon')) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 472db131563..5adb955e0d3 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -205,7 +205,7 @@ class Delivery extends CommonObject dol_syslog("Delivery::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - if (!isModEnabled('expedition_bon')) { + if (!getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { $commande = new Commande($this->db); $commande->id = $this->commande_id; $commande->fetch_lines(); @@ -233,8 +233,7 @@ class Delivery extends CommonObject $error++; } - if (!isModEnabled('expedition_bon')) { - // TODO standardize status uniformiser les statuts + if (!getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { $ret = $this->setStatut(2, $this->origin_id, $this->origin); if (!$ret) { $error++; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f2947e9b09f..fb4285f369d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -436,7 +436,7 @@ if (empty($reshook)) { $_GET["commande_id"] = GETPOST('commande_id', 'int'); $action = 'create'; } - } elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) { + } elseif ($action == 'create_delivery' && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->rights->expedition->delivery->creer) { // Build a receiving receipt $db->begin(); @@ -2157,13 +2157,13 @@ if ($action == 'create') { $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; - //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; $sql .= " AND obj.fk_".$origin." = ".((int) $origin_id); @@ -2592,7 +2592,7 @@ if ($action == 'create') { // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); - if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->delivery->creer && empty($object->linkedObjectsIds['delivery'])) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->delivery->creer && empty($object->linkedObjectsIds['delivery'])) { print dolGetButtonAction('', $langs->trans('CreateDeliveryOrder'), 'default', $_SERVER["PHP_SELF"].'?action=create_delivery&token='.newToken().'&id='.$object->id, ''); } // Close diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index c3ddf973049..f145c82c9ea 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -840,7 +840,7 @@ class Expedition extends CommonObject // phpcs:enable global $conf; - if ($conf->delivery_note->enabled) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED) { // Expedition validee include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2b8a54e999f..ac17743092e 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -142,8 +142,8 @@ $arrayfields = array( 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), - 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), - 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), + 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? 1 : 0)), + 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? 1 : 0)), 'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) ); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index a25737d5583..32a07ae40d4 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -36,10 +36,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $type = GETPOST("type", 'int'); -if ($type == '' && empty($user->rights->produit->lire)) { +if ($type == '' && !$user->hasRight('produit', 'lire') && $user->hasRight('service', 'lire')) { $type = '1'; // Force global page on service page only } -if ($type == '' && empty($user->rights->service->lire)) { +if ($type == '' && !$user->hasRight('service', 'lire') && $user->hasRight('produit', 'lire')) { $type = '0'; // Force global page on product page only } @@ -58,7 +58,7 @@ if ($type == '0') { } elseif ($type == '1') { $result = restrictedArea($user, 'service'); } else { - $result = restrictedArea($user, 'produit|service|expedition'); + $result = restrictedArea($user, 'produit|service|expedition|reception'); } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 7db91569a8d..c0871f5fae0 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1787,13 +1787,13 @@ if ($action == 'create') { $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot"; $sql .= ", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception"; - //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= ", ".MAIN_DB_PREFIX."reception as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; $sql .= " AND obj.fk_commande = ".((int) $origin_id);