dolibarr 19.0.4
mo_note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24// Load Dolibarr environment
25require '../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
27require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
28
29dol_include_once('/mrp/class/mo.class.php');
30dol_include_once('/mrp/lib/mrp_mo.lib.php');
31
32// Load translation files required by the page
33$langs->loadLangs(array("mrp", "companies"));
34
35// Get parameters
36$id = GETPOST('id', 'int');
37$ref = GETPOST('ref', 'alpha');
38$action = GETPOST('action', 'aZ09');
39$cancel = GETPOST('cancel', 'aZ09');
40$backtopage = GETPOST('backtopage', 'alpha');
41
42// Initialize technical objects
43$object = new Mo($db);
44$extrafields = new ExtraFields($db);
45$diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id;
46$hookmanager->initHooks(array('monote', 'globalcard')); // Note that conf->hooks_modules contains array
47
48// Fetch optionals attributes and labels
49$extrafields->fetch_name_optionals_label($object->table_element);
50
51// Load object
52include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
53if ($id > 0 || !empty($ref)) {
54 $upload_dir = $conf->mrp->multidir_output[empty($object->entity) ? $conf->entity : $object->entity]."/".$object->id;
55}
56
57// Security check - Protection if external user
58//if ($user->socid > 0) accessforbidden();
59//if ($user->socid > 0) $socid = $user->socid;
60$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
61$result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'rowid', $isdraft);
62
63$permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php
64
65
66
67/*
68 * Actions
69 */
70
71
72$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
73if ($reshook < 0) {
74 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
75}
76if (empty($reshook)) {
77 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
78}
79
80
81/*
82 * View
83 */
84
85$form = new Form($db);
86$formproject = new FormProjets($db);
87
88//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
89$help_url = '';
90llxHeader('', $langs->trans('Mo'), $help_url);
91
92if ($id > 0 || !empty($ref)) {
93 $object->fetch_thirdparty();
94
95 $head = moPrepareHead($object);
96
97 print dol_get_fiche_head($head, 'note', $langs->trans("ManufacturingOrder"), -1, $object->picto);
98
99 // Object card
100 // ------------------------------------------------------------
101 $linkback = '<a href="'.dol_buildpath('/mrp/mo_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
102
103 $morehtmlref = '<div class="refidno">';
104 // Ref customer
105 //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
106 //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
107 // Thirdparty
108 if (is_object($object->thirdparty)) {
109 $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer');
110 if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
111 $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
112 }
113 }
114 // Project
115 if (isModEnabled('project')) {
116 $langs->load("projects");
117 if (is_object($object->thirdparty)) {
118 $morehtmlref .= '<br>';
119 }
120 if (0) {
121 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
122 if ($action != 'classify') {
123 $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
124 }
125 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
126 } else {
127 if (!empty($object->fk_project)) {
128 $proj = new Project($db);
129 $proj->fetch($object->fk_project);
130 $morehtmlref .= $proj->getNomUrl(1);
131 if ($proj->title) {
132 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
133 }
134 }
135 }
136 }
137 $morehtmlref .= '</div>';
138
139 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
140
141
142 print '<div class="fichecenter">';
143 print '<div class="underbanner clearboth"></div>';
144
145
146 $cssclass = "titlefield";
147 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
148
149 print '</div>';
150
151 print dol_get_fiche_end();
152}
153
154// End of page
155llxFooter();
156$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage building of HTML components.
Class for Mo.
Definition mo.class.php:34
Class to manage projects.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
moPrepareHead($object)
Prepare array of tabs for Mo.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.