Merge branch 'patch-1' of https://github.com/PeartreeG/dolibarr into
PeartreeG-patch-1 Conflicts: htdocs/install/mysql/migration/3.9.0-4.0.0.sql htdocs/resource/element_resource.php
This commit is contained in:
commit
19162fc8d5
@ -524,6 +524,7 @@ if ($id == 11)
|
||||
'propal' => $langs->trans('Proposal'),
|
||||
'commande' => $langs->trans('Order'),
|
||||
'facture' => $langs->trans('Bill'),
|
||||
'resource' => $langs->trans('Resource'),
|
||||
// 'facture_fourn' => $langs->trans('SupplierBill'),
|
||||
'fichinter' => $langs->trans('InterventionCard')
|
||||
);
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -67,6 +69,15 @@ function fichinter_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention');
|
||||
|
||||
// Tab to link resources
|
||||
if ($conf->resource->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
$head[$h][2] = 'resource';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$nbNote = 0;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Module to manage locations, buildings, floors and rooms into Dolibarr ERP/CRM
|
||||
* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -28,7 +29,7 @@
|
||||
* @param Object $object Object
|
||||
* @return array Array of head entries
|
||||
*/
|
||||
function resourcePrepareHead($object)
|
||||
function resource_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$h = 0;
|
||||
@ -36,15 +37,50 @@ function resourcePrepareHead($object)
|
||||
|
||||
$head[$h][0] = dol_buildpath('/resource/card.php',1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ResourceCard");
|
||||
$head[$h][2] = 'resource';
|
||||
$head[$h][2] = 'resource';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Contact');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'resource');
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note_private)) $nbNote++;
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$upload_dir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
/*$head[$h][0] = DOL_URL_ROOT.'/resource/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Info');
|
||||
$head[$h][2] = 'info';
|
||||
$h++;*/
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'resource', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -396,3 +396,18 @@ ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price
|
||||
|
||||
-- Delete old deprecated field
|
||||
ALTER TABLE llx_product_stock DROP COLUMN pmp;
|
||||
|
||||
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE llx_resource ADD COLUMN asset_number varchar(255) after ref;
|
||||
ALTER TABLE llx_resource ADD COLUMN datec datetime DEFAULT NULL;
|
||||
ALTER TABLE llx_resource ADD COLUMN date_valid datetime DEFAULT NULL;
|
||||
ALTER TABLE llx_resource ADD COLUMN fk_user_author integer DEFAULT NULL;
|
||||
ALTER TABLE llx_resource ADD COLUMN fk_user_modif integer DEFAULT NULL;
|
||||
ALTER TABLE llx_resource ADD COLUMN fk_user_valid integer DEFAULT NULL;
|
||||
ALTER TABLE llx_resource ADD COLUMN fk_statut smallint NOT NULL DEFAULT '0';
|
||||
ALTER TABLE llx_resource ADD COLUMN import_key varchar(14);
|
||||
ALTER TABLE llx_resource ADD COLUMN extraparams varchar(255);
|
||||
|
||||
ALTER TABLE llx_element_resources ADD COLUMN duree real; -- total duration of using ressource
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ CREATE TABLE llx_element_resources
|
||||
resource_type varchar(64), -- resource or user
|
||||
busy integer,
|
||||
mandatory integer,
|
||||
duree real, -- total duration of using ressource
|
||||
fk_user_create integer,
|
||||
tms timestamp
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
-- Module to manage resources into Dolibarr ERP/CRM
|
||||
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
-- Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
@ -16,12 +17,21 @@
|
||||
|
||||
CREATE TABLE llx_resource
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
ref varchar(255),
|
||||
description text,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
ref varchar(255),
|
||||
asset_number varchar(255),
|
||||
description text,
|
||||
fk_code_type_resource varchar(32),
|
||||
note_public text,
|
||||
note_private text,
|
||||
tms timestamp
|
||||
)ENGINE=innodb;
|
||||
datec datetime DEFAULT NULL,
|
||||
date_valid datetime DEFAULT NULL,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_modif integer DEFAULT NULL,
|
||||
fk_user_valid integer DEFAULT NULL,
|
||||
fk_statut smallint NOT NULL DEFAULT '0',
|
||||
note_public text,
|
||||
note_private text,
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255), -- for stock other parameters with json format
|
||||
tms timestamp
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -152,7 +152,7 @@ $formresource = new FormResource($db);
|
||||
|
||||
if ( $object->fetch($id) > 0 )
|
||||
{
|
||||
$head=resourcePrepareHead($object);
|
||||
$head=resource_prepare_head($object);
|
||||
|
||||
|
||||
if ($action == 'edit' )
|
||||
|
||||
159
htdocs/resource/contact.php
Normal file
159
htdocs/resource/contact.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/resource/contact.php
|
||||
* \ingroup resource
|
||||
* \brief Onglet de gestion des contacts des resources
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$langs->load("resource");
|
||||
$langs->load("sendings");
|
||||
$langs->load("companies");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'resource', $id, 'resource');
|
||||
|
||||
$object = new DolResource($db);
|
||||
$result = $object->fetch($id,$ref);
|
||||
|
||||
|
||||
/*
|
||||
* Ajout d'un nouveau contact
|
||||
*/
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->resource->write)
|
||||
{
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
|
||||
$result = $object->add_contact($contactid, GETPOST('type','int'), GETPOST('source','alpha'));
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
$mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
}
|
||||
|
||||
setEventMessage($mesg, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->resource->write)
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne','int'));
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->resource->write)
|
||||
{
|
||||
$result = $object->delete_contact(GETPOST('lineid','int'));
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
llxHeader('',$langs->trans("Resource"));
|
||||
|
||||
// Mode vue et edition
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
|
||||
$head = resource_prepare_head($object);
|
||||
dol_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), 0, 'resource@resource');
|
||||
|
||||
|
||||
/*
|
||||
* Resource synthese pour rappel
|
||||
*/
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
print '<tr><td style="width:35%">'.$langs->trans("ResourceFormLabel_ref").'</td><td>';
|
||||
$linkback = $objet->ref.' <a href="list.php">'.$langs->trans("BackToList").'</a>';
|
||||
print $form->showrefnav($object, 'id', $linkback,1,"rowid");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Resource type
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("ResourceType") . '</td>';
|
||||
print '<td>';
|
||||
print $object->type_label;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (! empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_USER)) $hideaddcontactforuser=1;
|
||||
if (! empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_THIPARTY)) $hideaddcontactforthirdparty=1;
|
||||
|
||||
$permission=1;
|
||||
// Contacts lines
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
141
htdocs/resource/document.php
Normal file
141
htdocs/resource/document.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/resource/document.php
|
||||
* \ingroup resource
|
||||
* \brief Page des documents joints sur les resources
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("resource");
|
||||
$langs->load("companies");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'resource', $id, 'resource');
|
||||
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$object = new DolResource($db);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$upload_dir = $conf->resource->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart='resource';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Resource"));
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head=resource_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("ResourceSingular"), 0, 'resource');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
print '<tr><td style="width:35%">'.$langs->trans("ResourceFormLabel_ref").'</td><td>';
|
||||
$linkback = $objet->ref.' <a href="list.php">'.$langs->trans("BackToList").'</a>';
|
||||
print $form->showrefnav($object, 'id', $linkback,1,"rowid");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Resource type
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("ResourceType") . '</td>';
|
||||
print '<td>';
|
||||
print $object->type_label;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
$modulepart = 'dolresource';
|
||||
$permission = $user->rights->resource->write;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,8 +18,8 @@
|
||||
|
||||
/**
|
||||
* \file resource/element_resource.php
|
||||
* \ingroup resource
|
||||
* \brief Page to show and manage linked resources to an element
|
||||
* \ingroup resource
|
||||
* \brief Page to show and manage linked resources to an element
|
||||
*/
|
||||
|
||||
|
||||
@ -257,6 +258,47 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Specific to fichinter module
|
||||
*/
|
||||
if ($element_id && $element == 'fichinter')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
|
||||
|
||||
$fichinter = fetchObjectByElement($element_id, $element);
|
||||
if (is_object($fichinter))
|
||||
{
|
||||
$head=fichinter_prepare_head($fichinter);
|
||||
dol_fiche_head($head, 'resource', $langs->trans("InterventionCard"),0,'intervention');
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($fichinter, 'id', $linkback, ($user->societe_id?0:1), 'ref', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Customer
|
||||
if ( is_null($fichinter->client) )
|
||||
$fichinter->fetch_thirdparty();
|
||||
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$fichinter->client->getNomUrl(1).'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// hook for other elements linked
|
||||
$parameters=array('element'=>$element, 'element_id'=>$element_id );
|
||||
$reshook=$hookmanager->executeHooks('printElementTab',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
//print load_fiche_titre($langs->trans('ResourcesLinkedToElement'),'','');
|
||||
|
||||
@ -149,28 +149,6 @@ else
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action != "edit" )
|
||||
{
|
||||
// Edit resource
|
||||
if($user->rights->resource->write)
|
||||
{
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a href="add.php" class="butAction">'.$langs->trans('AddResource').'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
91
htdocs/resource/note.php
Normal file
91
htdocs/resource/note.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/resource/note.php
|
||||
* \ingroup fichinter
|
||||
* \brief Fiche d'information sur une resource
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
|
||||
|
||||
$langs->load('companies');
|
||||
$langs->load("interventions");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'resource', $id, 'resource');
|
||||
|
||||
$object = new DolResource($db);
|
||||
$object->fetch($id,$ref);
|
||||
|
||||
$permissionnote=$user->rights->resource->write; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$head = resource_prepare_head($object);
|
||||
dol_fiche_head($head, 'note', $langs->trans('ResourceSingular'), 0, 'resource@resource');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ResourceFormLabel_ref").'</td><td>';
|
||||
$linkback = $objet->ref.' <a href="list.php">'.$langs->trans("BackToList").'</a>';
|
||||
print $form->showrefnav($object, 'id', $linkback,1,"rowid");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Resource type
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("ResourceType") . '</td>';
|
||||
print '<td>';
|
||||
print $object->type_label;
|
||||
print '</td>';
|
||||
print '</tr>'; print "</table>";
|
||||
|
||||
print '<br>';
|
||||
$permission=$user->rights->resource->write;
|
||||
$cssclass='titlefield';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
Loading…
Reference in New Issue
Block a user