From 66093343b8feb5a7c74d302ebd772f5be63ca34c Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 9 Oct 2018 17:05:45 +0200 Subject: [PATCH] FIX linkedobjectblock tpl --- htdocs/reception/card.php | 1 + htdocs/reception/class/reception.class.php | 1 + htdocs/reception/index.php | 1 + htdocs/reception/shipment.php | 939 ------------------ htdocs/reception/stats/index.php | 1 + htdocs/reception/stats/month.php | 22 +- .../reception/tpl/linkedobjectblock.tpl.php | 10 +- 7 files changed, 20 insertions(+), 955 deletions(-) delete mode 100644 htdocs/reception/shipment.php diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index a462fb8e274..70f90bd0c98 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2016 Yasser Carreón + * Copyright (C) 2018 Quentin Vial-Gouteyron * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index fe6d24160fb..fc2ffc523b8 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2014-2015 Francis Appels * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Quentin Vial-Gouteyron * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index cc4c891d5f1..f6490940106 100644 --- a/htdocs/reception/index.php +++ b/htdocs/reception/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2005 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2018 Quentin Vial-Gouteyron * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/reception/shipment.php b/htdocs/reception/shipment.php deleted file mode 100644 index 849053c610c..00000000000 --- a/htdocs/reception/shipment.php +++ /dev/null @@ -1,939 +0,0 @@ - - * Copyright (C) 2005-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012-2015 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/expedition/shipment.php - * \ingroup expedition - * \brief Tab shipments/delivery receipts on the order - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; -} -if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - -$langs->load('orders'); -$langs->load("companies"); -$langs->load("bills"); -$langs->load('propal'); -$langs->load('deliveries'); -$langs->load('stocks'); -$langs->load("productbatch"); - -$id=GETPOST('id','int'); // id of order -$ref= GETPOST('ref','alpha'); -$action=GETPOST('action','alpha'); - -// Security check -$socid=0; -if (! empty($user->societe_id)) $socid=$user->societe_id; -$result=restrictedArea($user,'commande',$id); - -$object = new Commande($db); -$extrafields = new ExtraFields($db); - -// fetch optionals attributes and labels -$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - -// Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once - - - - -/* - * Actions - */ - -$parameters = array('socid' => $socid); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -if (empty($reshook)) -{ - // Categorisation dans projet - if ($action == 'classin') - { - $object = new Commande($db); - $object->fetch($id); - $object->setProject(GETPOST('projectid','int')); - } - - if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes') - { - $object = new Commande($db); - $object->fetch($id); - $result = $object->cloture($user); - } - - // Positionne ref commande client - else if ($action == 'setref_client' && $user->rights->commande->creer) { - $result = $object->set_ref_client($user, GETPOST('ref_client')); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - if ($action == 'setdatedelivery' && $user->rights->commande->creer) - { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); - - $object = new Commande($db); - $object->fetch($id); - $result=$object->set_date_livraison($user,$datelivraison); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - /* - if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) - { - $object = new Commande($db); - $object->fetch($id); - $object->setDeliveryAddress(GETPOST('delivery_address_id','int')); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - */ - if ($action == 'setmode' && $user->rights->commande->creer) - { - $object = new Commande($db); - $object->fetch($id); - $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - - if ($action == 'setavailability' && $user->rights->commande->creer) { - $object = new Commande($db); - $object->fetch($id); - $result=$object->availability(GETPOST('availability_id')); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - - if ($action == 'setdemandreason' && $user->rights->commande->creer) { - $object = new Commande($db); - $object->fetch($id); - $result=$object->demand_reason(GETPOST('demand_reason_id')); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - - if ($action == 'setconditions' && $user->rights->commande->creer) - { - $object = new Commande($db); - $object->fetch($id); - $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - - // shipping method - if ($action == 'setshippingmethod' && $user->rights->commande->creer) { - $object = new Commande($db); - $object->fetch($id); - $result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int')); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - - // warehouse - if ($action == 'setwarehouse' && $user->rights->commande->creer) { - $object = new Commande($db); - $object->fetch($id); - $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } - - if ($action == 'update_extras') - { - // Fill array 'array_options' with data from update form - $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); - if ($ret < 0) $error++; - - if (! $error) - { - // Actions on extra fields (by external module or standard code) - $hookmanager->initHooks(array('orderdao')); - $parameters = array('id' => $object->id); - $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by - // some hooks - if (empty($reshook)) { - $result = $object->insertExtraFields(); - if ($result < 0) { - $error++; - } - } else if ($reshook < 0) - $error++; - } - - if ($error) - $action = 'edit_extras'; - } - - if ($action == 'set_thirdparty' && $user->rights->commande->creer) - { - $object->fetch($id); - $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY'); - - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); - exit(); - } - - include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; - -} - -/* - * View - */ - -$form = new Form($db); -$formfile = new FormFile($db); -$formproduct = new FormProduct($db); -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } - -llxHeader('',$langs->trans('OrderCard'),''); - - -if ($id > 0 || ! empty($ref)) -{ - $object = new Commande($db); - if ( $object->fetch($id,$ref) > 0) - { - $object->loadExpeditions(1); - - $product_static=new Product($db); - - $soc = new Societe($db); - $soc->fetch($object->socid); - - $author = new User($db); - $author->fetch($object->user_author_id); - - $res = $object->fetch_optionals($object->id, $extralabels); - - $head = commande_prepare_head($object); - dol_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), -1, 'order'); - - - $formconfirm = ''; - - // Confirm validation - if ($action == 'cloture') - { - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); - - } - - if (! $formconfirm) { - $parameters = array(); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; - } - - // Print form confirm - print $formconfirm; - - - // Order card - - $linkback = '' . $langs->trans("BackToList") . ''; - - - $morehtmlref='
'; - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->commande->creer) - { - if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } - } - } - $morehtmlref.='
'; - - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - - print '
'; - print '
'; - print '
'; - - print ''; - - // Discounts for third party - print ''; - - // Date - print ''; - print ''; - print ''; - - // Delivery date planned - print ''; - // Note on several rows - //print ''; - print ''; - - // Shipping Method - print ''; - print ''; - - // Warehouse - if (! empty($conf->stock->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct=new FormProduct($db); - print ''; - print ''; - } - - // Terms of payment - /* - print ''; - - // Mode of payment - print '';*/ - - // Availability - print ''; - - // Source - print ''; - print ''; - print ''; - print ''; - } - - // TODO How record was recorded OrderMode (llx_c_input_method) - - // Incoterms - if (!empty($conf->incoterm->enabled)) - { - print ''; - print ''; - } - - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - - print '
'.$langs->trans('Discounts').''; - if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - print '. '; - $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); - $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); - $absolute_discount=price2num($absolute_discount,'MT'); - $absolute_creditnote=price2num($absolute_creditnote,'MT'); - if ($absolute_discount) - { - if ($object->statut > Commande::STATUS_DRAFT) - { - print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - } - else - { - // Remise dispo de type non avoir - $filter='fk_facture_source IS NULL'; - print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1); - } - } - if ($absolute_creditnote) - { - print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; - } - if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; - print '
'.$langs->trans('Date').''; - print dol_print_date($object->date,'daytext'); - if ($object->hasDelay() && empty($object->date_livraison)) { - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); - } - print '
'; - print ''; - - if ($action != 'editdate_livraison') print ''; - print '
'; - print $langs->trans('DateDeliveryPlanned'); - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'
'; - print '
'; - if ($action == 'editdate_livraison') - { - print '
'; - print ''; - print ''; - $form->select_date($object->date_livraison>0?$object->date_livraison:-1,'liv_','','','',"setdatedelivery"); - print ''; - print '
'; - } - else - { - print dol_print_date($object->date_livraison,'daytext'); - if ($object->hasDelay() && ! empty($object->date_livraison)) { - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); - } - } - print '
'.$langs->trans('NotePublic').' :
'; - //print nl2br($object->note_public); - //print '
'; - print ''; - if ($action != 'editshippingmethod' && $user->rights->expedition->creer) - print ''; - print '
'; - print $langs->trans('SendingMethod'); - print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; - print '
'; - if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); - } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); - } - print '
'; - print ''; - if ($action != 'editwarehouse' && $user->rights->commande->creer) - print ''; - print '
'; - print $langs->trans('Warehouse'); - print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).'
'; - print '
'; - if ($action == 'editwarehouse') { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); - } else { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); - } - print '
'; - print ''; - - if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print '
'; - if ($action == 'editconditions') - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); - } - else - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); - } - print '
'; - print ''; - if ($action != 'editmode' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; - print '
'; - if ($action == 'editmode') - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); - } - else - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); - } - print '
'; - print ''; - if ($action != 'editavailability') - print ''; - print '
'; - print $langs->trans('AvailabilityPeriod'); - print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '
'; - print '
'; - if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); - } else { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1); - } - print '
'; - print ''; - if ($action != 'editdemandreason') - print ''; - print '
'; - print $langs->trans('Source'); - print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '
'; - print '
'; - if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); - } else { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); - } - - $tmparray=$object->getTotalWeightVolume(); - $totalWeight=$tmparray['weight']; - $totalVolume=$tmparray['volume']; - if ($totalWeight || $totalVolume) - { - print '
'.$langs->trans("CalculatedWeight").''; - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); - print '
'.$langs->trans("CalculatedVolume").''; - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); - print '
'; - print '
'; - print $langs->trans('IncotermLabel'); - print ''; - if ($user->rights->commande->creer) print ''.img_edit().''; - else print ' '; - print '
'; - print '
'; - if ($action != 'editincoterm') - { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); - } - else - { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); - } - print '
'; - - print '
'; - print '
'; - print '
'; - print '
'; - - print ''; - - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) - { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; - } - - // Total HT - print ''; - print ''; - print ''; - - // Total VAT - print ''; - print ''; - - // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 - { - print ''; - print ''; - } - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF - { - print ''; - print ''; - } - - // Total TTC - print ''; - print ''; - - print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans('AmountHT').''.price($object->total_ht, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva, 0, '', 1, -1, -1, $conf->currency).'
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').''.price($object->total_ttc, 0, '', 1, -1, -1, $conf->currency).'
'; - - print '
'; - print '
'; - print '
'; - - print '

'; - - - - /** - * Lines or orders with quantity shipped and remain to ship - * Note: Qty shipped are already available into $object->expeditions[fk_product] - */ - print ''; - - $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,"; - $sql.= " cd.price, cd.tva_tx, cd.subprice,"; - $sql.= " cd.qty,"; - $sql.= ' cd.date_start,'; - $sql.= ' cd.date_end,'; - $sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc'; - $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; - $sql.= " WHERE cd.fk_commande = ".$object->id; - $sql.= " ORDER BY cd.rang, cd.rowid"; - - //print $sql; - dol_syslog("shipment.php", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->stock->enabled)) - { - print ''; - } - else - { - print ''; - } - print "\n"; - - $var=true; - $toBeShipped=array(); - $toBeShippedTotal=0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - - - // Show product and description - $type=isset($objp->type)?$objp->type:$objp->product_type; - - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (! empty($objp->date_start)) $type=1; - if (! empty($objp->date_end)) $type=1; - - print ''; - - // Product label - if ($objp->fk_product > 0) - { - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $object->fetch_thirdparty(); - - $prod = new Product($db); - $prod->id = $objp->fk_product; - $prod->entity = $objp->entity; - $prod->getMultiLangs(); - - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; - } - else - $label = (! empty($objp->label)?$objp->label:$objp->product_label); - - print ''; - } - else - { - print "\n"; - } - - // Qty ordered - print ''; - - // Qty already shipped - $qtyProdCom=$objp->qty; - print ''; - - // Qty remains to ship - print ''; - - if ($objp->fk_product > 0) - { - $product = new Product($db); - $product->fetch($objp->fk_product); - $product->load_stock('warehouseopen'); - } - - if ($objp->fk_product > 0 && $type == 0 && ! empty($conf->stock->enabled)) - { - print ''; - } - else - { - print ''; - } - print "\n"; - - // Show subproducts lines - if ($objp->fk_product > 0 && ! empty($conf->global->PRODUIT_SOUSPRODUITS)) - { - // Set tree of subproducts in product->sousprods - $product->get_sousproduits_arbo(); - //var_dump($product->sousprods);exit; - - // Define a new tree with quantiies recalculated - $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); - //var_dump($prods_arbo); - if (count($prods_arbo) > 0) - { - foreach($prods_arbo as $key => $value) - { - $img=''; - if ($value['stock'] < $value['stock_alert']) - { - $img=img_warning($langs->trans("StockTooLow")); - } - print ''; - print ''; - print ''; - print ''; - print ''."\n"; - } - } - } - - $i++; - } - $db->free($resql); - - if (! $num) - { - print '
'.$langs->trans("Description").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyShipped").''.$langs->trans("KeepToShip").''.$langs->trans("RealStock").' 
'; - print ''; // ancre pour retourner sur la ligne - - // Show product and description - $product_static->type=$type; - $product_static->id=$objp->fk_product; - $product_static->ref=$objp->ref; - $product_static->entity = $objp->entity; - $text=$product_static->getNomUrl(1); - $text.= ' - '.$label; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'
'; - $description.= $product_static->show_photos($conf->product->multidir_output[$product_static->entity],1,1,0,0,0,80); - print $form->textwithtooltip($text,$description,3,'','',$i); - - // Show range - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); - - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) - { - print ($objp->description && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):''; - } - - print '
"; - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); - - if (! empty($objp->label)) { - $text.= ' '.$objp->label.''; - print $form->textwithtooltip($text,$objp->description,3,'','',$i); - } else { - print $text.' '.nl2br($objp->description); - } - - // Show range - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); - print "' . $objp->qty . ''; - // Nb of sending products for this line of order - $qtyAlreadyShipped = (! empty($object->expeditions[$objp->rowid])?$object->expeditions[$objp->rowid]:0); - print $qtyAlreadyShipped; - print ''; - if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped; - $toBeShippedTotal += $toBeShipped[$objp->fk_product]; - print $toBeShipped[$objp->fk_product]; - } - else - { - print '0 ('.$langs->trans("Service").')'; - } - print ''; - print $product->stock_reel; - if ($product->stock_reel < $toBeShipped[$objp->fk_product]) - { - print ' '.img_warning($langs->trans("StockTooLow")); - } - print ' 
      -> '.$value['fullpath'].' ('.$value['nb'].') '.$value['nb_total'].'  '.$value['stock'].' '.$img.'
'.$langs->trans("NoArticleOfTypeProduct").'
'; - } - - print "
"; - } - else - { - dol_print_error($db); - } - - print ''; - - - /* - * Boutons Actions - */ - - if (empty($user->societe_id)) - { - print '
'; - - // Bouton expedier sans gestion des stocks - if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) - { - if ($user->rights->expedition->creer) - { - print ''.$langs->trans("CreateShipment").''; - if ($toBeShippedTotal <= 0) - { - print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); - } - } - else - { - print ''.$langs->trans("CreateShipment").''; - } - } - print "
"; - } - - - // Bouton expedier avec gestion des stocks - - if (! empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) - { - print $langs->trans("ValidateOrderFirstBeforeShipment"); - } - - if (! empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) - { - if ($user->rights->expedition->creer) - { - //print load_fiche_titre($langs->trans("CreateShipment")); - print '
'; - - print '
'; - print ''; - //print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - - $langs->load("stocks"); - - //print ''; - - if (! empty($conf->stock->enabled)) - { - //print ''; - //print ''; - } - //print ''; - - //print "
'; - print $langs->trans("WarehouseSource"); - //print ''; - print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); - if (count($formproduct->cache_warehouses) <= 0) - { - print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; - } - //print ''; - print ''; - if ($toBeShippedTotal <= 0) - { - print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); - } - //print '
"; - print "
\n"; - - print '
'; - - $somethingshown=1; - - } - else - { - print '
'; - print ''.$langs->trans("CreateShipment").''; - print '
'; - } - } - - show_list_sending_receive('commande',$object->id); - } - else - { - /* Commande non trouvee */ - print "Commande inexistante"; - } -} - - -llxFooter(); - -$db->close(); diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index a6f1f543c1d..d47f1bf550b 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2018 Quentin Vial-Gouteyron * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/reception/stats/month.php b/htdocs/reception/stats/month.php index b7d217217c2..df11f046e65 100644 --- a/htdocs/reception/stats/month.php +++ b/htdocs/reception/stats/month.php @@ -17,14 +17,14 @@ */ /** - * \file htdocs/expedition/stats/month.php + * \file htdocs/reception/stats/month.php * \ingroup commande - * \brief Page des stats expeditions par mois + * \brief Page des stats receptions par mois */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; -require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionstats.class.php'; +require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; +require_once DOL_DOCUMENT_ROOT.'/reception/class/receptionstats.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; @@ -39,15 +39,15 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $mesg = ''; -print load_fiche_titre($langs->trans("StatisticsOfSendings").' '.$_GET["year"], $mesg); +print load_fiche_titre($langs->trans("StatisticsOfReceptions").' '.$_GET["year"], $mesg); -$stats = new ExpeditionStats($db); -$data = $stats->getNbExpeditionByMonth($_GET["year"]); +$stats = new ReceptionStats($db); +$data = $stats->getNbReceptionByMonth($_GET["year"]); -dol_mkdir($conf->expedition->dir_temp); +dol_mkdir($conf->reception->dir_temp); -$filename = $conf->expedition->dir_temp."/expedition".$year.".png"; -$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=expeditionstats&file=expedition'.$year.'.png'; +$filename = $conf->reception->dir_temp."/reception".$year.".png"; +$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=reception'.$year.'.png'; $px = new DolGraph(); $mesg = $px->isGraphKo(); @@ -65,7 +65,7 @@ if (! $mesg) } print ''; -print ''; +print ''; print ''; diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index b55654f4786..d6dd383ccc8 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -27,7 +27,7 @@ global $user; $langs = $GLOBALS['langs']; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; -$langs->load("sendings"); +$langs->load("receptions"); $total=0; $ilink=0; $var=true; @@ -39,20 +39,20 @@ foreach($linkedObjectBlock as $key => $objectlink) if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - +
Nombre d expedition par mois
Nombre d reception par mois'; print $px->show(); print '
trans("Shipment"); ?>trans("Reception"); ?> getNomUrl(1); ?> date_delivery,'day'); ?> rights->expedition->lire) { + if ($user->rights->reception->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> element != 'commande') { + // For now, receptions must stay linked to order, so link is not deletable + if($object->element != 'order_supplier') { ?> ">transnoentitiesnoconv("RemoveLink")); ?>