dolibarr  13.0.2
note.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
7  * Copyright (C) 2015 Marcos GarcĂ­a <marcosgdf@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
32 
33 // Load translation files required by the page
34 $langs->load("companies");
35 
36 $id = GETPOST('id', 'int');
37 $ref = GETPOST('ref', 'alpha');
38 $action = GETPOST('action', 'aZ09');
39 
40 // Security check
41 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
42 $fieldtype = (!empty($ref) ? 'ref' : 'rowid');
43 if ($user->socid) $socid = $user->socid;
44 $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
45 
46 $object = new Product($db);
47 if ($id > 0 || !empty($ref)) $object->fetch($id, $ref);
48 
49 $permissionnote = $user->rights->produit->creer; // Used by the include of actions_setnotes.inc.php
50 
51 
52 /*
53  * Actions
54  */
55 
56 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
57 
58 
59 /*
60  * View
61  */
62 
63 $form = new Form($db);
64 
65 $helpurl = '';
66 if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
67 if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
68 
69 $title = $langs->trans('ProductServiceCard');
70 $shortlabel = dol_trunc($object->label, 16);
71 if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT))
72 {
73  $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Notes');
74  $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
75 }
76 if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE))
77 {
78  $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Notes');
79  $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
80 }
81 
82 llxHeader('', $title, $help_url);
83 
84 if ($id > 0 || !empty($ref))
85 {
86  /*
87  * Affichage onglets
88  */
89  if (!empty($conf->notification->enabled)) $langs->load("mails");
90 
91  $head = product_prepare_head($object);
92  $titre = $langs->trans("CardProduct".$object->type);
93  $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
94 
95  print dol_get_fiche_head($head, 'note', $titre, -1, $picto);
96 
97  $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
98  $object->next_prev_filter = " fk_product_type = ".$object->type;
99 
100  $shownav = 1;
101  if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
102 
103  dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
104 
105  $cssclass = 'titlefield';
106  //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
107  //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
108 
109  //print '<div class="fichecenter">';
110 
111  print '<div class="underbanner clearboth"></div>';
112 
113  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
114 
116 }
117 
118 // End of page
119 llxFooter();
120 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage products or services.
const TYPE_SERVICE
Service.
const TYPE_PRODUCT
Regular product.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
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_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding &#39;...&#39; if string larger than length.
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.
llxFooter()
Empty footer.
Definition: wrapper.php:59
product_prepare_head($object)
Prepare array with list of tabs.
Definition: product.lib.php:35