dolibarr  9.0.0
note.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
30 if (! empty($conf->projet->enabled)) {
31  require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
32  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
33 }
34 
35 // Load translation files required by the page
36 $langs->loadLangs(array('sendings', 'companies', 'bills', 'deliveries', 'orders', 'stocks', 'other', 'propal'));
37 
38 $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
39 $ref=GETPOST('ref','alpha');
40 $action=GETPOST('action','alpha');
41 
42 // Security check
43 $socid='';
44 if ($user->societe_id) $socid=$user->societe_id;
45 $result=restrictedArea($user, $origin, $origin_id);
46 
47 $object = new Expedition($db);
48 if ($id > 0 || ! empty($ref))
49 {
50  $object->fetch($id, $ref);
51  $object->fetch_thirdparty();
52 
53  if (!empty($object->origin))
54  {
55  $typeobject = $object->origin;
56  $origin = $object->origin;
57  $object->fetch_origin();
58  }
59 
60  // Linked documents
61  if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled))
62  {
63  $objectsrc=new Commande($db);
64  $objectsrc->fetch($object->$typeobject->id);
65  }
66  if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled))
67  {
68  $objectsrc=new Propal($db);
69  $objectsrc->fetch($object->$typeobject->id);
70  }
71 }
72 
73 $permissionnote=$user->rights->expedition->creer; // Used by the include of actions_setnotes.inc.php
74 
75 
76 /*
77  * Actions
78  */
79 
80 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
81 
82 
83 /*
84  * View
85  */
86 
87 llxHeader();
88 
89 $form = new Form($db);
90 
91 if ($id > 0 || ! empty($ref))
92 {
93 
94  $head=shipping_prepare_head($object);
95  dol_fiche_head($head, 'note', $langs->trans("Shipment"), -1, 'sending');
96 
97 
98  // Shipment card
99  $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
100 
101  $morehtmlref='<div class="refidno">';
102  // Ref customer shipment
103  $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1);
104  $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1);
105  // Thirdparty
106  $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
107  // Project
108  if (! empty($conf->projet->enabled)) {
109  $langs->load("projects");
110  $morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
111  if (0) { // Do not change on shipment
112  if ($action != 'classify') {
113  $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
114  }
115  if ($action == 'classify') {
116  // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
117  $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
118  $morehtmlref .= '<input type="hidden" name="action" value="classin">';
119  $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
120  $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
121  $morehtmlref .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
122  $morehtmlref .= '</form>';
123  } else {
124  $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
125  }
126  } else {
127  // We don't have project on shipment, so we will use the project or source object instead
128  // TODO Add project on shipment
129  $morehtmlref .= ' : ';
130  if (! empty($objectsrc->fk_project)) {
131  $proj = new Project($db);
132  $proj->fetch($objectsrc->fk_project);
133  $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
134  $morehtmlref .= $proj->ref;
135  $morehtmlref .= '</a>';
136  } else {
137  $morehtmlref .= '';
138  }
139  }
140  }
141  $morehtmlref.='</div>';
142 
143 
144  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
145 
146 
147  print '<div class="underbanner clearboth"></div>';
148 
149  $cssclass='titlefield';
150  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
151 
152  dol_fiche_end();
153 }
154 
155 // End of page
156 llxFooter();
157 $db->close();
shipping_prepare_head($object)
Prepare array with list of tabs.
llxFooter()
Empty footer.
Definition: wrapper.php:56
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
img_edit($titlealt='default', $float=0, $other='class="pictoedit"')
Show logo editer/modifier fiche.
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.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage shipments.
dol_fiche_end($notab=0)
Show tab footer of a card.
Class to manage customers orders.
llxHeader()
Empty header.
Definition: wrapper.php:44
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
Class to manage proposals.