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';
34 $langs->load(
"companies");
38 $action =
GETPOST(
'action',
'aZ09');
41 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref :
''));
42 $fieldtype = (!empty($ref) ?
'ref' :
'rowid');
44 $socid = $user->socid;
48 if ($id > 0 || !empty($ref)) {
49 $object->fetch($id, $ref);
52 $permissionnote = $user->rights->produit->creer;
54 if ($object->id > 0) {
55 if ($object->type == $object::TYPE_PRODUCT) {
56 restrictedArea($user,
'produit', $object->id,
'product&product',
'',
'');
58 if ($object->type == $object::TYPE_SERVICE) {
59 restrictedArea($user,
'service', $object->id,
'product&product',
'',
'');
62 restrictedArea($user,
'produit|service', $fieldvalue,
'product&product',
'',
'', $fieldtype);
66 $hookmanager->initHooks(array(
'productnote'));
72 $reshook = $hookmanager->executeHooks(
'doActions', array(), $object, $action);
76 if (empty($reshook)) {
77 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
89 $help_url =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
92 $help_url =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
95 $title = $langs->trans(
'ProductServiceCard');
96 $shortlabel =
dol_trunc($object->label, 16);
98 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'Notes');
99 $help_url =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
102 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'Notes');
103 $help_url =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
108 if ($id > 0 || !empty($ref)) {
112 if (!empty($conf->notification->enabled)) {
113 $langs->load(
"mails");
117 $titre = $langs->trans(
"CardProduct".$object->type);
122 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
123 $object->next_prev_filter =
" fk_product_type = ".$object->type;
126 if ($user->socid && !in_array(
'product', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
132 $cssclass =
'titlefield';
138 print
'<div class="underbanner clearboth"></div>';
140 include DOL_DOCUMENT_ROOT.
'/core/tpl/notes.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
Class to manage products or services.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
const TYPE_SERVICE
Service.
const TYPE_PRODUCT
Regular product.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
restrictedArea($user, $features, $objectid=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.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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 '…' 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.
product_prepare_head($object)
Prepare array with list of tabs.