31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46$langs->loadLangs(array(
'products'));
50$action =
GETPOST(
'action',
'aZ09');
52$fieldvalue = (!empty($id) ?
$id : (!empty($ref) ? $ref :
''));
53$fieldtype = (!empty($ref) ?
'ref' :
'rowid');
55 $socid = $user->socid;
59$result =
$object->fetch($id, $ref);
61 print
'Record not found';
66 if (
$object->type == $object::TYPE_PRODUCT) {
69 if (
$object->type == $object::TYPE_SERVICE) {
73 restrictedArea($user,
'product|service', $fieldvalue,
'product&product',
'',
'', $fieldtype);
77$usercancreate = ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'));
83if ($action ==
'addcontact' && $usercancreate) {
84 if ($result > 0 && $id > 0) {
87 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
91 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
94 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
95 $langs->load(
"errors");
96 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
103} elseif ($action ==
'swapstatut' && $usercancreate) {
106} elseif ($action ==
'deletecontact' && $usercancreate) {
111 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
123$form =
new Form($db);
125$contactstatic =
new Contact($db);
126$userstatic =
new User($db);
128$title = $langs->trans(
'ProductServiceCard');
132 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'Notes');
133 $help_url =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos|DE:Modul_Produkte';
136 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'Notes');
137 $help_url =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Leistungen';
140llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-card_note');
144if ($id > 0 || !empty($ref)) {
148 $titre = $langs->trans(
"CardProduct".
$object->type);
154 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1&type='.
$object->type.
'">'.$langs->trans(
"BackToList").
'</a>';
155 $object->next_prev_filter =
"(te.fk_product_type:=:".((int)
$object->type).
")";
158 if ($user->socid && !in_array(
'product', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
162 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref');
169 $hideaddcontactforuser = 1;
172 $hideaddcontactforthirdparty = 1;
176 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
177 foreach ($dirtpls as $reldir) {
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
product_prepare_head($object)
Prepare array with list of tabs.
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.