dolibarr/htdocs/product/stock/info.php

115 lines
3.8 KiB
PHP
Raw Normal View History

<?php
2009-02-19 20:06:12 +01:00
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/product/stock/info.php
* \ingroup stock
* \brief Page des informations d'un entrepot
2008-11-26 13:01:51 +01:00
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
2018-05-26 23:52:52 +02:00
// Load translation files required by the page
$langs->load("stocks");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
2017-12-24 15:02:15 +01:00
2013-01-10 08:27:12 +01:00
// Security check
2019-02-14 15:23:07 +01:00
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
$result = restrictedArea($user, 'stock');
2022-07-20 16:35:51 +02:00
$usercancreate = $user->rights->stock->creer;
/*
2009-02-19 20:06:12 +01:00
* View
*/
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
llxHeader("", $langs->trans("Stocks"), $help_url);
2009-02-19 20:06:12 +01:00
2016-10-24 20:52:21 +02:00
$object = new Entrepot($db);
2017-12-24 15:02:15 +01:00
$object->fetch($id, $ref);
$object->info($object->id);
2016-10-24 20:52:21 +02:00
$head = stock_prepare_head($object);
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head($head, 'info', $langs->trans("Warehouse"), -1, 'stock');
$linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
2016-10-24 20:52:21 +02:00
$morehtmlref = '<div class="refidno">';
$morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
2021-04-27 22:36:25 +02:00
// Project
2022-06-14 17:53:17 +02:00
if (!empty($conf->project->enabled)) {
2021-04-27 22:36:25 +02:00
$langs->load("projects");
$morehtmlref .= '<br>'.img_picto('', 'project').' '.$langs->trans('Project').' ';
if ($usercancreate) {
if ($action != 'classify') {
2021-09-18 22:09:55 +02:00
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
2021-04-27 22:36:25 +02:00
}
if ($action == 'classify') {
$projectid = $object->fk_project;
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
2022-07-20 16:35:51 +02:00
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!empty($object->socid) ? $object->socid : 0), $object->fk_project, 'none', 0, 0, 0, 1);
2021-04-27 22:36:25 +02:00
}
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
2021-10-29 09:40:38 +02:00
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
2021-04-27 22:36:25 +02:00
} else {
$morehtmlref .= '';
}
}
}
$morehtmlref .= '</div>';
2016-10-24 20:52:21 +02:00
$shownav = 1;
2021-02-26 14:25:17 +01:00
if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
$shownav = 0;
}
2017-12-24 15:02:15 +01:00
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
2016-10-24 20:52:21 +02:00
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
dol_print_object_info($object);
2005-08-13 01:53:32 +02:00
print '</div>';
2018-08-15 12:48:13 +02:00
// End of page
llxFooter();
$db->close();