First version of resource module
This commit is contained in:
parent
3776f7b146
commit
9de6368be9
93
class/actions_resource.class.php
Normal file
93
class/actions_resource.class.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Jean-François FERRY <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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 resource/class/actions_resource.class.php
|
||||
* \brief Place module actions
|
||||
*/
|
||||
|
||||
class ActionsResource
|
||||
{
|
||||
|
||||
var $db;
|
||||
var $error;
|
||||
var $errors=array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
function doActions($parameters, &$object, &$action) {
|
||||
|
||||
global $langs,$user;
|
||||
$langs->load('resource@resource');
|
||||
|
||||
if (in_array('element_resource',explode(':',$parameters['context'])))
|
||||
{
|
||||
// Efface une ressource
|
||||
if ($action == 'confirm_delete_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes')
|
||||
{
|
||||
$res = $object->fetch(GETPOST('lineid'));
|
||||
if($res)
|
||||
{
|
||||
$result = $object->delete_resource(GETPOST('lineid'),GETPOST('element'));
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?element=".GETPOST('element')."&element_id=".GETPOST('element_id'));
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update ressource
|
||||
if ($action == 'update_resource' && $user->rights->resource->write && !GETPOST('cancel') )
|
||||
{
|
||||
$res = $object->fetch(GETPOST('lineid'));
|
||||
if($res)
|
||||
{
|
||||
$object->id = GETPOST('lineid');
|
||||
$object->busy = GETPOST('busy');
|
||||
$object->mandatory = GETPOST('mandatory');
|
||||
|
||||
$result = $object->update();
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated'));
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?element=".GETPOST('element')."&element_id=".GETPOST('element_id'));
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
145
class/html.formresource.class.php
Normal file
145
class/html.formresource.class.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/* Copyright (C) - 2013 Jean-François FERRY <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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 2 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 place/class/html.place.class.php
|
||||
* \ingroup core
|
||||
* \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Classe permettant la gestion des formulaire du module place
|
||||
*
|
||||
* @package resource
|
||||
|
||||
* \remarks Utilisation: $formresource = new FormResource($db)
|
||||
* \remarks $formplace->proprietes=1 ou chaine ou tableau de valeurs
|
||||
*/
|
||||
class FormResource
|
||||
{
|
||||
var $db;
|
||||
|
||||
var $substit=array();
|
||||
var $param=array();
|
||||
|
||||
var $error;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output html form to select a location (place)
|
||||
*
|
||||
* @param string $selected Preselected type
|
||||
* @param string $htmlname Name of field in form
|
||||
* @param string $filter Optionnal filters criteras (example: 's.rowid <> x')
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param string $filterkey Filter on key value
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $limit Limit number of answers
|
||||
* @return string HTML string with
|
||||
*/
|
||||
function select_resource_list($selected='',$htmlname='fk_resource',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array(), $filterkey='', $outputmode=0, $limit=20)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$out='';
|
||||
$outarray=array();
|
||||
|
||||
$resourcestat = new Resource($this->db);
|
||||
|
||||
$resources_used = $resourcestat->fetch_all_used('ASC', 't.rowid', $limit, $offset, $filter='');
|
||||
|
||||
$out = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
//$out.= '<input type="hidden" name="action" value="search">';
|
||||
//$out.= '<input type="hidden" name="id" value="'.$theme->id.'">';
|
||||
|
||||
if ($resourcestat)
|
||||
{
|
||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||
{
|
||||
//$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
|
||||
$out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
// Construct $out and $outarray
|
||||
$out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">'."\n";
|
||||
if ($showempty) $out.= '<option value="-1"></option>'."\n";
|
||||
$num = count($resourcestat->lines);
|
||||
|
||||
//var_dump($resourcestat->lines);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ( $i < $num)
|
||||
{
|
||||
$label=$langs->trans(ucfirst($resourcestat->lines[$i]->element)).' : ';
|
||||
$label.=$resourcestat->lines[$i]->ref?$resourcestat->lines[$i]->ref:''.$resourcestat->lines[$i]->label;
|
||||
|
||||
if ($selected > 0 && $selected == $resourcestat->lines[$i]->id)
|
||||
{
|
||||
$out.= '<option value="'.$resourcestat->lines[$i]->id.'" selected="selected">'.$label.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="'.$resourcestat->lines[$i]->id.'">'.$label.'</option>';
|
||||
}
|
||||
|
||||
array_push($outarray, array('key'=>$resourcestat->lines[$i]->id, 'value'=>$resourcestat->lines[$i]->label, 'label'=>$resourcestat->lines[$i]->label));
|
||||
|
||||
$i++;
|
||||
if (($i % 10) == 0) $out.="\n";
|
||||
}
|
||||
}
|
||||
$out.= '</select>'."\n";
|
||||
|
||||
|
||||
$out.= '<input type="submit" class="button" value="'.$langs->trans("Search").'"> ';
|
||||
|
||||
$out.= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
if ($outputmode) return $outarray;
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
598
class/resource.class.php
Normal file
598
class/resource.class.php
Normal file
@ -0,0 +1,598 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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 place/class/resource.class.php
|
||||
* \ingroup place
|
||||
* \brief Class file for resource object
|
||||
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* DAO Resource object
|
||||
*/
|
||||
class Resource extends CommonObject
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
//var $element='resource'; //!< Id that identify managed objects
|
||||
//var $table_element='llx_resource'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
|
||||
var $resource_id;
|
||||
var $resource_type;
|
||||
var $element_id;
|
||||
var $element_type;
|
||||
var $busy;
|
||||
var $mandatory;
|
||||
var $fk_user_create;
|
||||
var $tms='';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
* @param id id object
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.resource_id,";
|
||||
$sql.= " t.resource_type,";
|
||||
$sql.= " t.element_id,";
|
||||
$sql.= " t.element_type,";
|
||||
$sql.= " t.busy,";
|
||||
$sql.= " t.mandatory,";
|
||||
$sql.= " t.fk_user_create,";
|
||||
$sql.= " t.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."element_resources as t";
|
||||
$sql.= " WHERE t.rowid = ".$this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->resource_id = $obj->resource_id;
|
||||
$this->resource_type = $obj->resource_type;
|
||||
$this->element_id = $obj->element_id;
|
||||
$this->element_type = $obj->element_type;
|
||||
$this->busy = $obj->busy;
|
||||
$this->mandatory = $obj->mandatory;
|
||||
$this->fk_user_create = $obj->fk_user_create;
|
||||
|
||||
if($obj->resource_id && $obj->resource_type)
|
||||
$this->objresource = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type);
|
||||
if($obj->element_id && $obj->element_type)
|
||||
$this->objelement = $this->fetchObjectByElement($obj->element_id,$obj->element_type);
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all objects into $this->lines
|
||||
*
|
||||
* @param string $sortorder sort order
|
||||
* @param string $sortfield sort field
|
||||
* @param int $limit limit page
|
||||
* @param int $offset page
|
||||
* @param array $filter filter output
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_all($sortorder, $sortfield, $limit, $offset, $filter='')
|
||||
{
|
||||
global $conf;
|
||||
$sql="SELECT ";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.resource_id,";
|
||||
$sql.= " t.resource_type,";
|
||||
$sql.= " t.element_id,";
|
||||
$sql.= " t.element_type,";
|
||||
$sql.= " t.busy,";
|
||||
$sql.= " t.mandatory,";
|
||||
$sql.= " t.fk_user_create,";
|
||||
$sql.= " t.tms";
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .'element_resources as t ';
|
||||
//$sql.= " WHERE t.entity IN (".getEntity('resource').")";
|
||||
|
||||
//Manage filter
|
||||
if (!empty($filter)){
|
||||
foreach($filter as $key => $value) {
|
||||
if (strpos($key,'date')) {
|
||||
$sql.= ' AND '.$key.' = \''.$this->db->idate($value).'\'';
|
||||
}
|
||||
else {
|
||||
$sql.= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= " GROUP BY t.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder " . $this->db->plimit( $limit + 1 ,$offset);
|
||||
dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$line = new Resource($this->db);
|
||||
$line->id = $obj->rowid;
|
||||
$line->resource_id = $obj->resource_id;
|
||||
$line->resource_type = $obj->resource_type;
|
||||
$line->element_id = $obj->element_id;
|
||||
$line->element_type = $obj->element_type;
|
||||
$line->busy = $obj->busy;
|
||||
$line->mandatory = $obj->mandatory;
|
||||
$line->fk_user_create = $obj->fk_user_create;
|
||||
|
||||
if($obj->resource_id && $obj->resource_type)
|
||||
$line->objresource = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type);
|
||||
if($obj->element_id && $obj->element_type)
|
||||
$line->objelement = $this->fetchObjectByElement($obj->element_id,$obj->element_type);
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all objects into $this->lines
|
||||
*
|
||||
* @param string $sortorder sort order
|
||||
* @param string $sortfield sort field
|
||||
* @param int $limit limit page
|
||||
* @param int $offset page
|
||||
* @param array $filter filter output
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_all_used($sortorder="ASC",$sortfield="t.rowid",$limit, $offset, $filter='')
|
||||
{
|
||||
global $conf;
|
||||
$sql="SELECT ";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.resource_id,";
|
||||
$sql.= " t.resource_type,";
|
||||
$sql.= " t.element_id,";
|
||||
$sql.= " t.element_type,";
|
||||
$sql.= " t.busy,";
|
||||
$sql.= " t.mandatory,";
|
||||
$sql.= " t.fk_user_create,";
|
||||
$sql.= " t.tms";
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .'element_resources as t ';
|
||||
//$sql.= " WHERE t.entity IN (".getEntity('resource').")";
|
||||
|
||||
//Manage filter
|
||||
if (!empty($filter)){
|
||||
foreach($filter as $key => $value) {
|
||||
if (strpos($key,'date')) {
|
||||
$sql.= ' AND '.$key.' = \''.$this->db->idate($value).'\'';
|
||||
}
|
||||
else {
|
||||
$sql.= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= " GROUP BY t.resource_id";
|
||||
$sql.= " ORDER BY $sortfield $sortorder " . $this->db->plimit( $limit + 1 ,$offset);
|
||||
dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$line = new Resource($this->db);
|
||||
$line->id = $obj->rowid;
|
||||
$line->resource_id = $obj->resource_id;
|
||||
$line->resource_type = $obj->resource_type;
|
||||
$line->element_id = $obj->element_id;
|
||||
$line->element_type = $obj->element_type;
|
||||
$line->busy = $obj->busy;
|
||||
$line->mandatory = $obj->mandatory;
|
||||
$line->fk_user_create = $obj->fk_user_create;
|
||||
|
||||
$this->lines[$i] = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all resources available, declared by modules
|
||||
*
|
||||
* Load available resource in array $this->available_resources
|
||||
*
|
||||
*
|
||||
* @return int number of available resources declared by modules
|
||||
*/
|
||||
function fetch_all_available() {
|
||||
global $conf;
|
||||
|
||||
if (! empty($conf->modules_parts['resources']))
|
||||
{
|
||||
$this->available_resources=(array) $conf->modules_parts['resources'];
|
||||
|
||||
return count($this->available_resources);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->resource_id)) $this->resource_id=trim($this->resource_id);
|
||||
if (isset($this->resource_type)) $this->resource_type=trim($this->resource_type);
|
||||
if (isset($this->element_id)) $this->element_id=trim($this->element_id);
|
||||
if (isset($this->element_type)) $this->element_type=trim($this->element_type);
|
||||
if (isset($this->busy)) $this->busy=trim($this->busy);
|
||||
if (isset($this->mandatory)) $this->mandatory=trim($this->mandatory);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."element_resources SET";
|
||||
$sql.= " resource_id=".(isset($this->resource_id)?"'".$this->db->escape($this->resource_id)."'":"null").",";
|
||||
$sql.= " resource_type=".(isset($this->resource_type)?"'".$this->resource_type."'":"null").",";
|
||||
$sql.= " element_id=".(isset($this->element_id)?$this->element_id:"null").",";
|
||||
$sql.= " element_type=".(isset($this->element_type)?"'".$this->db->escape($this->element_type)."'":"null").",";
|
||||
$sql.= " busy=".(isset($this->busy)?$this->busy:"null").",";
|
||||
$sql.= " mandatory=".(isset($this->mandatory)?$this->mandatory:"null").",";
|
||||
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null')."";
|
||||
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
// Call triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('RESOURCE_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $element_type Element type project_task
|
||||
* @return array
|
||||
*/
|
||||
function getElementProperties($element_type)
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$module = $element = $subelement = $element_type;
|
||||
|
||||
// If we ask an resource form external module (instead of default path)
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$element_type,$regs))
|
||||
{
|
||||
$element = $subelement = $regs[1];
|
||||
$module = $regs[2];
|
||||
}
|
||||
|
||||
//print '<br />1. element : '.$element.' - module : '.$module .'<br />';
|
||||
|
||||
if ( preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
|
||||
{
|
||||
$module = $element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
$classfile = strtolower($subelement);
|
||||
$classname = ucfirst($subelement);
|
||||
$classpath = $module.'/class';
|
||||
|
||||
|
||||
// For compat
|
||||
if($element_type == "action") {
|
||||
$classpath = 'comm/action/class';
|
||||
$subelement = 'Actioncomm';
|
||||
$classfile = strtolower($subelement);
|
||||
$classname = ucfirst($subelement);
|
||||
$module = 'agenda';
|
||||
}
|
||||
|
||||
|
||||
$element_properties = array(
|
||||
'module' => $module,
|
||||
'classpath' => $classpath,
|
||||
'element' => $element,
|
||||
'subelement' => $subelement,
|
||||
'classfile' => $classfile,
|
||||
'classname' => $classname
|
||||
);
|
||||
return $element_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch an object with element_type and his id
|
||||
* Inclusion classes is automatic
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetchObjectByElement($element_id,$element_type) {
|
||||
|
||||
global $conf;
|
||||
|
||||
$element_prop = $this->getElementProperties($element_type);
|
||||
|
||||
if (is_array($element_prop) && $conf->$element_prop['module']->enabled)
|
||||
{
|
||||
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
|
||||
|
||||
$objectstat = new $element_prop['classname']($this->db);
|
||||
$ret = $objectstat->fetch($element_id);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
return $objectstat;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add resources to the actioncom object
|
||||
*
|
||||
* @param int $element_id Element id
|
||||
* @param string $element_type Element type
|
||||
* @param int $resource_id Resource id
|
||||
* @param string $resource_type Resource type
|
||||
* @param array $resource Resources linked with element
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function add_element_resource($element_id,$element_type,$resource_id,$resource_element,$busy=0,$mandatory=0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_resources (";
|
||||
$sql.= "resource_id";
|
||||
$sql.= ", resource_type";
|
||||
$sql.= ", element_id";
|
||||
$sql.= ", element_type";
|
||||
$sql.= ", busy";
|
||||
$sql.= ", mandatory";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $resource_id;
|
||||
$sql.= ", '".$resource_element."'";
|
||||
$sql.= ", '".$element_id."'";
|
||||
$sql.= ", '".$element_type."'";
|
||||
$sql.= ", '".$busy."'";
|
||||
$sql.= ", '".$mandatory."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::add_element_resource sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return an array with resources linked to the element
|
||||
*
|
||||
*
|
||||
*/
|
||||
function getElementResources($element,$element_id,$resource_type='')
|
||||
{
|
||||
|
||||
// Links beetween objects are stored in this table
|
||||
$sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources';
|
||||
$sql.= " WHERE element_id='".$element_id."' AND element_type='".$element."'";
|
||||
if($resource_type)
|
||||
$sql.=" AND resource_type LIKE '%".$resource_type."%'";
|
||||
$sql .= ' ORDER BY resource_type';
|
||||
|
||||
dol_syslog(get_class($this)."::getElementResources sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$resources[$i] = array(
|
||||
'rowid' => $obj->rowid,
|
||||
'resource_id' => $obj->resource_id,
|
||||
'resource_type'=>$obj->resource_type,
|
||||
'busy'=>$obj->busy,
|
||||
'mandatory'=>$obj->mandatory
|
||||
);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $resources;
|
||||
}
|
||||
|
||||
function fetchElementResources($element,$element_id)
|
||||
{
|
||||
$resources = $this->getElementResources($element,$element_id);
|
||||
$i=0;
|
||||
foreach($resources as $nb => $resource)
|
||||
{
|
||||
$this->lines[$i] = $this->fetchObjectByElement($resource['resource_id'],$resource['resource_type']);
|
||||
$i++;
|
||||
}
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a link to resource line
|
||||
* TODO: move into commonobject class
|
||||
*
|
||||
* @param int $rowid Id of resource line to delete
|
||||
* @param int $element element name (for trigger) TODO: use $this->element into commonobject class
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function delete_resource($rowid, $element, $notrigger=0)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
||||
$sql.= " WHERE rowid =".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete_resource sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers(strtoupper($element).'_DELETE_RESOURCE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete_resource error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
158
core/ajax/resource_action.json.php
Normal file
158
core/ajax/resource_action.json.php
Normal file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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 resource/core/ajax/resource_action.json.php
|
||||
* \ingroup resource
|
||||
* \brief This file is used for resource planning
|
||||
*/
|
||||
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||
$res=0;
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include '../../../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory
|
||||
if (! $res && file_exists("../../../../main.inc.php")) $res=@include '../../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory
|
||||
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
dol_include_once('/resource/class/resource.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
$start = GETPOST('start','int');
|
||||
$end = GETPOST('end','int');
|
||||
$fk_resource = GETPOST('fk_resource','int');
|
||||
|
||||
|
||||
// Get event in an array
|
||||
$eventarray=array();
|
||||
|
||||
$sql = 'SELECT a.id,a.label,';
|
||||
$sql.= ' a.datep,';
|
||||
$sql.= ' a.datep2,';
|
||||
$sql.= ' a.datea,';
|
||||
$sql.= ' a.datea2,';
|
||||
$sql.= ' a.percent,';
|
||||
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
|
||||
$sql.= ' a.priority, a.fulldayevent, a.location,';
|
||||
$sql.= ' a.fk_soc, a.fk_contact,';
|
||||
$sql.= ' ca.code';
|
||||
$sql.= ' FROM ('.MAIN_DB_PREFIX.'c_actioncomm as ca,';
|
||||
$sql.= " ".MAIN_DB_PREFIX.'user as u,';
|
||||
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a)";
|
||||
if($fk_resource > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'element_resources as r ON a.id = r.element_id ';
|
||||
}
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
if($fk_resource > 0) {
|
||||
$sql.= " AND r.resource_id = '".$db->escape($fk_resource)."'";
|
||||
}
|
||||
$sql.= ' AND a.fk_user_author = u.rowid';
|
||||
$sql.= ' AND a.entity IN ('.getEntity().')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
|
||||
|
||||
|
||||
|
||||
if ($type) $sql.= " AND ca.id = ".$type;
|
||||
if ($status == 'done') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
||||
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
||||
if ($filtera > 0 || $filtert > 0 || $filterd > 0)
|
||||
{
|
||||
$sql.= " AND (";
|
||||
if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera;
|
||||
if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert;
|
||||
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
|
||||
$sql.= ")";
|
||||
}
|
||||
$sql.= ' GROUP BY a.id';
|
||||
// Sort on date
|
||||
$sql.= ' ORDER BY datep';
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Create a new object action
|
||||
$event=new ActionComm($db);
|
||||
$event->id=$obj->id;
|
||||
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
||||
$event->datef=$db->jdate($obj->datep2);
|
||||
$event->type_code=$obj->code;
|
||||
$event->libelle=$obj->label;
|
||||
$event->percentage=$obj->percent;
|
||||
$event->author->id=$obj->fk_user_author; // user id of creator
|
||||
$event->usertodo->id=$obj->fk_user_action; // user id of owner
|
||||
$event->userdone->id=$obj->fk_user_done; // deprecated
|
||||
// $event->userstodo=... with s after user, in future version, will be an array with all id of user assigned to event
|
||||
$event->priority=$obj->priority;
|
||||
$event->fulldayevent=$obj->fulldayevent;
|
||||
$event->location=$obj->location;
|
||||
|
||||
$event->societe->id=$obj->fk_soc;
|
||||
$event->contact->id=$obj->fk_contact;
|
||||
|
||||
|
||||
$eventarray[]=$event;
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
//var_dump($eventarray);
|
||||
foreach ($eventarray as $day => $event) {
|
||||
$event_json[] = array(
|
||||
'id' => $event->id,
|
||||
'title' => $event->libelle,
|
||||
'start' => $event->datep,
|
||||
'end' => $event->datef,
|
||||
'end' => $event->datef,
|
||||
'allDay' => $event->fulldayevent?true:false,
|
||||
'url' => dol_buildpath("/comm/action/fiche.php",1).'?id='. $event->id
|
||||
);
|
||||
}
|
||||
|
||||
//var_dump($event_json);
|
||||
echo json_encode($event_json);
|
||||
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
437
core/modules/modResource.class.php
Normal file
437
core/modules/modResource.class.php
Normal file
@ -0,0 +1,437 @@
|
||||
<?php
|
||||
/* Module to manage resources into Dolibarr ERP/CRM
|
||||
* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup resource Resource module
|
||||
* \brief Resource module descriptor.
|
||||
* \file core/modules/modResource.class.php
|
||||
* \ingroup resource
|
||||
* \brief Description and activation file for module Resource
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
|
||||
|
||||
/**
|
||||
* Description and activation class for module Resource
|
||||
*/
|
||||
class modResource extends DolibarrModules
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use a free id here
|
||||
// (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 110111;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'resource';
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "hr";
|
||||
// Module label (no space allowed)
|
||||
// used if translation string 'ModuleXXXName' not found
|
||||
// (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
// Module description
|
||||
// used if translation string 'ModuleXXXDesc' not found
|
||||
// (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Description of module Resource";
|
||||
// Possible values for version are: 'development', 'experimental' or version
|
||||
$this->version = '0.1';
|
||||
// Key used in llx_const table to save module status enabled/disabled
|
||||
// (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
||||
// Where to store the module in setup page
|
||||
// (0=common,1=interface,2=others,3=very specific)
|
||||
$this->special = 0;
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png
|
||||
// use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png
|
||||
// use this->picto='pictovalue@module'
|
||||
$this->picto = 'resource@resource'; // mypicto@resource
|
||||
// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
|
||||
// for default path (eg: /resource/core/xxxxx) (0=disable, 1=enable)
|
||||
// for specific path of parts (eg: /resource/core/modules/barcode)
|
||||
// for specific css file (eg: /resource/css/resource.css.php)
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory
|
||||
//'triggers' => 1,
|
||||
// Set this to 1 if module has its own login method directory
|
||||
//'login' => 0,
|
||||
// Set this to 1 if module has its own substitution function file
|
||||
//'substitutions' => 0,
|
||||
// Set this to 1 if module has its own menus handler directory
|
||||
//'menus' => 0,
|
||||
// Set this to 1 if module has its own barcode directory
|
||||
//'barcode' => 0,
|
||||
// Set this to 1 if module has its own models directory
|
||||
//'models' => 0,
|
||||
// Set this to relative path of css if module has its own css file
|
||||
'css' => '/resource/css/resource.css.php',
|
||||
// Set here all hooks context managed by module
|
||||
'hooks' => array('actioncard','actioncommdao','element_resource')
|
||||
// Set here all workflow context managed by module
|
||||
//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
|
||||
);
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/resource/temp");
|
||||
$this->dirs = array("/resource");
|
||||
|
||||
// Config pages. Put here list of php pages
|
||||
// stored into resource/admin directory, used to setup module.
|
||||
$this->config_page_url = array("admin_resource.php@resource");
|
||||
|
||||
// Dependencies
|
||||
// List of modules id that must be enabled if this module is enabled
|
||||
$this->depends = array();
|
||||
// List of modules id to disable if this one is disabled
|
||||
$this->requiredby = array('modPlace');
|
||||
// Minimum version of PHP required by module
|
||||
$this->phpmin = array(5, 3);
|
||||
// Minimum version of Dolibarr required by module
|
||||
$this->need_dolibarr_version = array(3, 4);
|
||||
$this->langfiles = array("resource@resource"); // langfiles@resource
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled
|
||||
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example:
|
||||
$this->const = array(
|
||||
0=>array(
|
||||
'PLACE_DEFAULT_ZOOM_FOR_MAP',
|
||||
'chaine',
|
||||
'1',
|
||||
'This is a constant to defined default zoom into link to OSM map',
|
||||
1
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
// Example:
|
||||
$this->tabs = array(
|
||||
// // To add a new tab identified by code tabname1
|
||||
// 'objecttype:+tabname1:Title1:langfile@resource:$user->rights->resource->read:/resource/mynewtab1.php?id=__ID__',
|
||||
// // To add another new tab identified by code tabname2
|
||||
// 'objecttype:+tabname2:Title2:langfile@resource:$user->rights->othermodule->read:/resource/mynewtab2.php?id=__ID__',
|
||||
// // To remove an existing tab identified by code tabname
|
||||
// 'objecttype:-tabname'
|
||||
);
|
||||
// where objecttype can be
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'product' to add a tab in product view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'user' to add a tab in user view
|
||||
// 'group' to add a tab in group view
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'categories_x' to add a tab in category view
|
||||
// (reresource 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
|
||||
$this->tabs = array(
|
||||
'action:+resources:Resources:resource@resource:$user->rights->resource->read:/resource/element_resource.php?element=action&element_id=__ID__',
|
||||
'thirdparty:+resources:Resources:resource@resource:$user->rights->resource->read:/resource/element_resource.php?element=societe&element_id=__ID__'
|
||||
);
|
||||
|
||||
/* Example:
|
||||
// This is to avoid warnings
|
||||
if (! isset($conf->resource->enabled)) $conf->resource->enabled=0;
|
||||
$this->dictionnaries=array(
|
||||
'langs'=>'resource@resource',
|
||||
// List of tables we want to see into dictonnary editor
|
||||
'tabname'=>array(
|
||||
MAIN_DB_PREFIX."table1",
|
||||
MAIN_DB_PREFIX."table2",
|
||||
MAIN_DB_PREFIX."table3"
|
||||
),
|
||||
// Label of tables
|
||||
'tablib'=>array("Table1","Table2","Table3"),
|
||||
// Request to select fields
|
||||
'tabsql'=>array(
|
||||
'SELECT f.rowid as rowid, f.code, f.label, f.active'
|
||||
. ' FROM ' . MAIN_DB_PREFIX . 'table1 as f',
|
||||
'SELECT f.rowid as rowid, f.code, f.label, f.active'
|
||||
. ' FROM ' . MAIN_DB_PREFIX . 'table2 as f',
|
||||
'SELECT f.rowid as rowid, f.code, f.label, f.active'
|
||||
. ' FROM ' . MAIN_DB_PREFIX . 'table3 as f'
|
||||
),
|
||||
// Sort order
|
||||
'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
|
||||
// List of fields (result of select to show dictionnary)
|
||||
'tabfield'=>array("code,label","code,label","code,label"),
|
||||
// List of fields (list of fields to edit a record)
|
||||
'tabfieldvalue'=>array("code,label","code,label","code,label"),
|
||||
// List of fields (list of fields for insert)
|
||||
'tabfieldinsert'=>array("code,label","code,label","code,label"),
|
||||
// Name of columns with primary key (try to always name it 'rowid')
|
||||
'tabrowid'=>array("rowid","rowid","rowid"),
|
||||
// Condition to show each dictionnary
|
||||
'tabcond'=>array(
|
||||
$conf->resource->enabled,
|
||||
$conf->resource->enabled,
|
||||
$conf->resource->enabled
|
||||
)
|
||||
);
|
||||
*/
|
||||
|
||||
// Boxes
|
||||
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
|
||||
$this->boxes = array(); // Boxes list
|
||||
$r = 0;
|
||||
// Example:
|
||||
|
||||
//$this->boxes[$r][1] = "MyBox@resource";
|
||||
//$r ++;
|
||||
/*
|
||||
$this->boxes[$r][1] = "myboxb.php";
|
||||
$r++;
|
||||
*/
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r = 0;
|
||||
|
||||
$this->rights[$r][0] = 1101201;
|
||||
$this->rights[$r][1] = 'See resources';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'read';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 1101202;
|
||||
$this->rights[$r][1] = 'Modify resources';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'write';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 1101203;
|
||||
$this->rights[$r][1] = 'Delete resources';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'delete';
|
||||
$r++;
|
||||
|
||||
|
||||
// Add here list of permission defined by
|
||||
// an id, a label, a boolean and two constant strings.
|
||||
// Example:
|
||||
//// Permission id (must not be already used)
|
||||
//$this->rights[$r][0] = 2000;
|
||||
//// Permission label
|
||||
//$this->rights[$r][1] = 'Permision label';
|
||||
//// Permission by default for new user (0/1)
|
||||
//$this->rights[$r][3] = 1;
|
||||
//// In php code, permission will be checked by test
|
||||
//// if ($user->rights->permkey->level1->level2)
|
||||
//$this->rights[$r][4] = 'level1';
|
||||
//// In php code, permission will be checked by test
|
||||
//// if ($user->rights->permkey->level1->level2)
|
||||
//$this->rights[$r][5] = 'level2';
|
||||
//$r++;
|
||||
// Main menu entries
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r = 0;
|
||||
|
||||
// Menus declaration
|
||||
$this->menu[$r]=array(
|
||||
'fk_menu'=>'fk_mainmenu=tools',
|
||||
'type'=>'left',
|
||||
'titre'=> 'MenuResourceIndex',
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=> 'resource',
|
||||
'url'=> '/resource/index.php',
|
||||
'langs'=> 'resource@resource',
|
||||
'position'=> 100,
|
||||
'enabled'=> '1',
|
||||
'perms'=> '$user->rights->resource->read',
|
||||
'user'=> 0
|
||||
);
|
||||
$r++;
|
||||
|
||||
// Menus declaration
|
||||
$this->menu[$r]=array(
|
||||
'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=resource',
|
||||
'type'=>'left',
|
||||
'titre'=> 'MenuResourcePlanning',
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=> '',
|
||||
'url'=> '/resource/resource_planning.php',
|
||||
'langs'=> 'resource@resource',
|
||||
'position'=> 101,
|
||||
'enabled'=> '1',
|
||||
'perms'=> '$user->rights->resource->read',
|
||||
'user'=> 0
|
||||
);
|
||||
$r++;
|
||||
|
||||
|
||||
// Exports
|
||||
$r = 1;
|
||||
|
||||
// Example:
|
||||
//$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
//// Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
|
||||
//// Condition to show export in list (ie: '$user->id==3').
|
||||
//// Set to 1 to always show when module is enabled.
|
||||
//$this->export_enabled[$r]='1';
|
||||
//$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
//$this->export_fields_array[$r]=array(
|
||||
// 's.rowid'=>"IdCompany",
|
||||
// 's.nom'=>'CompanyName',
|
||||
// 's.address'=>'Address',
|
||||
// 's.cp'=>'Zip',
|
||||
// 's.ville'=>'Town',
|
||||
// 's.fk_pays'=>'Country',
|
||||
// 's.tel'=>'Phone',
|
||||
// 's.siren'=>'ProfId1',
|
||||
// 's.siret'=>'ProfId2',
|
||||
// 's.ape'=>'ProfId3',
|
||||
// 's.idprof4'=>'ProfId4',
|
||||
// 's.code_compta'=>'CustomerAccountancyCode',
|
||||
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||
// 'f.rowid'=>"InvoiceId",
|
||||
// 'f.facnumber'=>"InvoiceRef",
|
||||
// 'f.datec'=>"InvoiceDateCreation",
|
||||
// 'f.datef'=>"DateInvoice",
|
||||
// 'f.total'=>"TotalHT",
|
||||
// 'f.total_ttc'=>"TotalTTC",
|
||||
// 'f.tva'=>"TotalVAT",
|
||||
// 'f.paye'=>"InvoicePaid",
|
||||
// 'f.fk_statut'=>'InvoiceStatus',
|
||||
// 'f.note'=>"InvoiceNote",
|
||||
// 'fd.rowid'=>'LineId',
|
||||
// 'fd.description'=>"LineDescription",
|
||||
// 'fd.price'=>"LineUnitPrice",
|
||||
// 'fd.tva_tx'=>"LineVATRate",
|
||||
// 'fd.qty'=>"LineQty",
|
||||
// 'fd.total_ht'=>"LineTotalHT",
|
||||
// 'fd.total_tva'=>"LineTotalTVA",
|
||||
// 'fd.total_ttc'=>"LineTotalTTC",
|
||||
// 'fd.date_start'=>"DateStart",
|
||||
// 'fd.date_end'=>"DateEnd",
|
||||
// 'fd.fk_product'=>'ProductId',
|
||||
// 'p.ref'=>'ProductRef'
|
||||
//);
|
||||
//$this->export_entities_array[$r]=array('s.rowid'=>"company",
|
||||
// 's.nom'=>'company',
|
||||
// 's.address'=>'company',
|
||||
// 's.cp'=>'company',
|
||||
// 's.ville'=>'company',
|
||||
// 's.fk_pays'=>'company',
|
||||
// 's.tel'=>'company',
|
||||
// 's.siren'=>'company',
|
||||
// 's.siret'=>'company',
|
||||
// 's.ape'=>'company',
|
||||
// 's.idprof4'=>'company',
|
||||
// 's.code_compta'=>'company',
|
||||
// 's.code_compta_fournisseur'=>'company',
|
||||
// 'f.rowid'=>"invoice",
|
||||
// 'f.facnumber'=>"invoice",
|
||||
// 'f.datec'=>"invoice",
|
||||
// 'f.datef'=>"invoice",
|
||||
// 'f.total'=>"invoice",
|
||||
// 'f.total_ttc'=>"invoice",
|
||||
// 'f.tva'=>"invoice",
|
||||
// 'f.paye'=>"invoice",
|
||||
// 'f.fk_statut'=>'invoice',
|
||||
// 'f.note'=>"invoice",
|
||||
// 'fd.rowid'=>'invoice_line',
|
||||
// 'fd.description'=>"invoice_line",
|
||||
// 'fd.price'=>"invoice_line",
|
||||
// 'fd.total_ht'=>"invoice_line",
|
||||
// 'fd.total_tva'=>"invoice_line",
|
||||
// 'fd.total_ttc'=>"invoice_line",
|
||||
// 'fd.tva_tx'=>"invoice_line",
|
||||
// 'fd.qty'=>"invoice_line",
|
||||
// 'fd.date_start'=>"invoice_line",
|
||||
// 'fd.date_end'=>"invoice_line",
|
||||
// 'fd.fk_product'=>'product',
|
||||
// 'p.ref'=>'product'
|
||||
//);
|
||||
//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
|
||||
// . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
|
||||
//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
|
||||
// . 'product as p on (fd.fk_product = p.rowid)';
|
||||
//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
|
||||
// . 'AND f.rowid = fd.fk_facture';
|
||||
//$r++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus
|
||||
* (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
$result = $this->loadTables();
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function remove($options = '')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create tables, keys and data required by module
|
||||
* Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
|
||||
* and create data commands must be stored in directory /resource/sql/
|
||||
* This function is called by this->init
|
||||
*
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function loadTables()
|
||||
{
|
||||
return $this->_load_tables('/resource/sql/');
|
||||
}
|
||||
}
|
||||
6
core/tpl/resource_add.tpl.php
Normal file
6
core/tpl/resource_add.tpl.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
print '<div class="error">'.$langs->trans('NotAvailableYet').'</div>';
|
||||
print '<br />';
|
||||
// FIN DU TPL
|
||||
111
core/tpl/resource_view.tpl.php
Normal file
111
core/tpl/resource_view.tpl.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
//var_dump($linked_resources);
|
||||
|
||||
$form= new Form($db);
|
||||
|
||||
|
||||
if( (array) $linked_resources && count($linked_resources) > 0)
|
||||
{
|
||||
$var=false;
|
||||
|
||||
// TODO: DEBUT DU TPL
|
||||
if($mode == 'edit' )
|
||||
{
|
||||
|
||||
print '<div class="tagtable centpercent noborder allwidth">';
|
||||
print '<form class="tagtr liste_titre">';
|
||||
print '<div class="tagtd">'.$langs->trans('Type').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Resource').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Busy').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Mandatory').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Edit').'</div>';
|
||||
print '</form>';
|
||||
//print '</div>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
print '<div class="tagtable centpercent noborder allwidth">';
|
||||
print '<form class="tagtr liste_titre">';
|
||||
print '<div class="tagtd">'.$langs->trans('Type').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Resource').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Busy').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Mandatory').'</div>';
|
||||
print '<div class="tagtd">'.$langs->trans('Edit').'</div>';
|
||||
print '</form>';
|
||||
//print '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach ($linked_resources as $linked_resource)
|
||||
{
|
||||
$var=!$var;
|
||||
$object_resource = $object->fetchObjectByElement($linked_resource['resource_id'],$linked_resource['resource_type']);
|
||||
|
||||
if($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid'))
|
||||
{
|
||||
|
||||
/*print '<form $bc[$var]; ?> action="<?php echo $_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id; ?>" method="POST">';*/
|
||||
|
||||
print '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'" />';
|
||||
print '<input type="hidden" name="action" value="update_resource" />';
|
||||
print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
|
||||
print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
|
||||
|
||||
print '<div class="tagtd"></div>';
|
||||
print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
|
||||
print '<div class="tagtd">'.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
|
||||
print '<div class="tagtd">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
|
||||
print '<div class="tagtd"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
|
||||
print '</form>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$style='';
|
||||
if($linked_resource['rowid'] == GETPOST('lineid'))
|
||||
$style='style="background: orange;"';
|
||||
|
||||
print '<div class="tagtr '.($var==true?"pair":"impair").'" '.$style.'>';
|
||||
|
||||
print '<div class="tagtd">';
|
||||
print $langs->trans(ucfirst($object_resource->element));
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tagtd">';
|
||||
print $object_resource->getNomUrl(1);
|
||||
print '</div class="tagtd">';
|
||||
|
||||
print '<div class="tagtd">';
|
||||
print $linked_resource['busy']?1:0;
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tagtd">';
|
||||
print $linked_resource['mandatory']?1:0;
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tagtd">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">'.$langs->trans('Edit').'</a>';
|
||||
print '</div>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
print '<div class="warning">'.$langs->trans('NoResourceLinked').'</div>';
|
||||
|
||||
}
|
||||
// FIN DU TPL
|
||||
236
element_resource.php
Normal file
236
element_resource.php
Normal file
@ -0,0 +1,236 @@
|
||||
<?php
|
||||
/* Module to manage locations, buildings, floors and rooms into Dolibarr ERP/CRM
|
||||
* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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 resource/element_resource.php
|
||||
* \ingroup resource
|
||||
* \brief Page to show and manage linked resources to an element
|
||||
*/
|
||||
|
||||
|
||||
$res=0;
|
||||
$res=@include("../main.inc.php"); // For root directory
|
||||
if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
require 'class/resource.class.php';
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("resource@resource");
|
||||
$langs->load("other");
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$mode = GETPOST('mode','alpha');
|
||||
$lineid = GETPOST('lineid','int');
|
||||
$element = GETPOST('element','alpha');
|
||||
$element_id = GETPOST('element_id','int');
|
||||
$resource_id = GETPOST('resource_id','int');
|
||||
$resource_type = GETPOST('resource_type','alpha');
|
||||
|
||||
/*
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
*/
|
||||
|
||||
if( ! $user->rights->place->read)
|
||||
accessforbidden();
|
||||
|
||||
$object=new Resource($db);
|
||||
|
||||
$hookmanager->initHooks(array('element_resource'));
|
||||
|
||||
$parameters=array('resource_id'=>$resource_id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
||||
|
||||
/***************************************************
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
****************************************************/
|
||||
|
||||
$pagetitle=$langs->trans('ResourceElementPage');
|
||||
llxHeader('',$pagetitle,'');
|
||||
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
// Load available resource, declared by modules
|
||||
$ret = $object->fetch_all_available();
|
||||
if($ret == -1) {
|
||||
dol_print_error($db,$object->error);
|
||||
exit;
|
||||
}
|
||||
if(!$ret) {
|
||||
print '<div class="warning">'.$langs->trans('NoResourceInDatabase').'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Confirmation suppression resource line
|
||||
if ($action == 'delete_resource')
|
||||
{
|
||||
print $form->formconfirm("element_resource.php?element=".$element."&element_id=".$element_id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_resource",'','',1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Specific to agenda module
|
||||
*/
|
||||
if($element_id && $element == 'action')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
|
||||
$act = $object->fetchObjectByElement($element_id,$element);
|
||||
if(is_object($act)) {
|
||||
|
||||
$head=actions_prepare_head($act);
|
||||
|
||||
dol_fiche_head($head, 'resources', $langs->trans("Action"),0,'action');
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Specific to thirdparty module
|
||||
*/
|
||||
if($element_id && $element == 'societe')
|
||||
{
|
||||
$socstatic = $object->fetchObjectByElement($element_id,$element);
|
||||
if(is_object($socstatic)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
$head = societe_prepare_head($socstatic);
|
||||
|
||||
dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
//$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="25%">'.$langs->trans('ThirdPartyName').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($socstatic, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans('ResourcesLinkedToElement'),'','resource_32@resource');
|
||||
|
||||
|
||||
foreach ($object->available_resources as $modresources => $resources)
|
||||
{
|
||||
$langs->load($modresources);
|
||||
//print '<h2>'.$modresources.'</h2>';
|
||||
//var_dump($resources);
|
||||
|
||||
$resources=(array) $resources; // To be sure $resources is an array
|
||||
foreach($resources as $resource_obj)
|
||||
{
|
||||
$element_prop = $object->getElementProperties($resource_obj);
|
||||
//var_dump($element_prop);
|
||||
|
||||
print_titre($langs->trans(ucfirst($element_prop['element']).'Singular'));
|
||||
|
||||
//print '/'.$modresources.'/class/'.$resource_obj.'.class.php<br />';
|
||||
|
||||
$linked_resources = $object->getElementResources($element,$element_id,$resource_obj);
|
||||
|
||||
if ( $mode == 'add' && $resource_obj == $resource_type)
|
||||
{
|
||||
//print '/'.$element_prop['module'].'/core/tpl/resource_'.$element_prop['element'].'_'.$mode.'.tpl.php';
|
||||
|
||||
$path = '';
|
||||
if(strpos($element_prop['module'],'@'))
|
||||
$path .= '/'.$element_prop['module'];
|
||||
|
||||
// If we have a specific template we use it
|
||||
if(file_exists(dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_'.$mode.'.tpl.php')))
|
||||
{
|
||||
$res=include dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_'.$mode.'.tpl.php');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$res=@include dol_buildpath('/resource/core/tpl/resource_add.tpl.php');
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '/'.$element_prop['module'].'/core/tpl/resource_'.$element_prop['element'].'_view.tpl.php';
|
||||
|
||||
// If we have a specific template we use it
|
||||
if(file_exists(dol_buildpath('/'.$element_prop['module'].'/core/tpl/resource_'.$element_prop['element'].'_view.tpl.php')))
|
||||
{
|
||||
$res=@include dol_buildpath('/'.$element_prop['module'].'/core/tpl/resource_'.$element_prop['element'].'_view.tpl.php');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$res=include dol_buildpath('/resource/core/tpl/resource_view.tpl.php');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($resource_obj!=$resource_type )
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?mode=add&resource_type='.$resource_obj.'&element='.$element.'&element_id='.$element_id.'">Add resource</a>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
167
index.php
Normal file
167
index.php
Normal file
@ -0,0 +1,167 @@
|
||||
<?php
|
||||
/* Module to manage locations, buildings, floors and rooms into Dolibarr ERP/CRM
|
||||
* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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 place/index.php
|
||||
* \ingroup place
|
||||
* \brief Page to manage place object
|
||||
*/
|
||||
|
||||
|
||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||
$res=0;
|
||||
$res=@include("../main.inc.php"); // For root directory
|
||||
if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
require 'class/resource.class.php';
|
||||
|
||||
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("resource@resource");
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
$lineid = GETPOST('lineid','int');
|
||||
$element = GETPOST('element','alpha');
|
||||
$element_id = GETPOST('element_id','int');
|
||||
$resource_id = GETPOST('resource_id','int');
|
||||
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
|
||||
$object = new Resource($db);
|
||||
|
||||
$hookmanager->initHooks(array('element_resource'));
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
||||
|
||||
if (empty($sortorder)) $sortorder="DESC";
|
||||
if (empty($sortfield)) $sortfield="t.rowid";
|
||||
if (empty($arch)) $arch = 0;
|
||||
|
||||
if ($page == -1) {
|
||||
$page = 0 ;
|
||||
}
|
||||
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if( ! $user->rights->place->read)
|
||||
accessforbidden();
|
||||
|
||||
/***************************************************
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
****************************************************/
|
||||
|
||||
$pagetitle=$langs->trans('ResourcePageIndex');
|
||||
llxHeader('',$pagetitle,'');
|
||||
|
||||
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
print_fiche_titre($pagetitle,'','resource_32.png@resource');
|
||||
|
||||
// Confirmation suppression resource line
|
||||
if ($action == 'delete_resource')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_resource",'','',1);
|
||||
}
|
||||
|
||||
// Load object list
|
||||
$ret = $object->fetch_all($sortorder, $sortfield, $limit, $offset);
|
||||
if($ret == -1) {
|
||||
dol_print_error($db,$object->error);
|
||||
exit;
|
||||
}
|
||||
if(!$ret) {
|
||||
print '<div class="warning">'.$langs->trans('NoResourceInDatabase').'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$var=false;
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Resource'),$_SERVER['PHP_SELF'],'t.resource_id','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Element'),$_SERVER['PHP_SELF'],'t.element_id','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Edit'));
|
||||
print '</tr>';
|
||||
|
||||
foreach ($object->lines as $resource)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
$style='';
|
||||
if($resource->id == GETPOST('lineid'))
|
||||
$style='style="background: orange;"';
|
||||
|
||||
print '<tr '.$bc[$var].' '.$style.'><td>';
|
||||
//print $resource->getNomUrl(1);
|
||||
if(is_object($resource->objresource))
|
||||
print $resource->objresource->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(is_object($resource->objelement))
|
||||
print $resource->objelement->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&element='.$resource->element_type.'&element_id='.$resource->element_id.'&lineid='.$resource->id.'">'.$langs->trans('Delete').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Action Bar
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a href="resource_planning.php" class="butAction">'.$langs->trans('ShowResourcePlanning').'</a>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
589
js/fullcalendar/fullcalendar.css
Normal file
589
js/fullcalendar/fullcalendar.css
Normal file
@ -0,0 +1,589 @@
|
||||
/*!
|
||||
* FullCalendar v1.6.4 Stylesheet
|
||||
* Docs & License: http://arshaw.com/fullcalendar/
|
||||
* (c) 2013 Adam Shaw
|
||||
*/
|
||||
|
||||
|
||||
.fc {
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.fc table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
html .fc,
|
||||
.fc table {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.fc td,
|
||||
.fc th {
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Header
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-header td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fc-header-left {
|
||||
width: 25%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.fc-header-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fc-header-right {
|
||||
width: 25%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.fc-header-title {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.fc-header-title h2 {
|
||||
margin-top: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fc .fc-header-space {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.fc-header .fc-button {
|
||||
margin-bottom: 1em;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* buttons edges butting together */
|
||||
|
||||
.fc-header .fc-button {
|
||||
margin-right: -1px;
|
||||
}
|
||||
|
||||
.fc-header .fc-corner-right, /* non-theme */
|
||||
.fc-header .ui-corner-right { /* theme */
|
||||
margin-right: 0; /* back to normal */
|
||||
}
|
||||
|
||||
/* button layering (for border precedence) */
|
||||
|
||||
.fc-header .fc-state-hover,
|
||||
.fc-header .ui-state-hover {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.fc-header .fc-state-down {
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.fc-header .fc-state-active,
|
||||
.fc-header .ui-state-active {
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Content
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-content {
|
||||
clear: both;
|
||||
zoom: 1; /* for IE7, gives accurate coordinates for [un]freezeContentHeight */
|
||||
}
|
||||
|
||||
.fc-view {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Cell Styles
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-widget-header, /* <th>, usually */
|
||||
.fc-widget-content { /* <td>, usually */
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.fc-state-highlight { /* <td> today cell */ /* TODO: add .fc-today to <th> */
|
||||
background: #fcf8e3;
|
||||
}
|
||||
|
||||
.fc-cell-overlay { /* semi-transparent rectangle while dragging */
|
||||
background: #bce8f1;
|
||||
opacity: .3;
|
||||
filter: alpha(opacity=30); /* for IE */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Buttons
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-button {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 0 .6em;
|
||||
overflow: hidden;
|
||||
height: 1.9em;
|
||||
line-height: 1.9em;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.fc-state-default { /* non-theme */
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.fc-state-default.fc-corner-left { /* non-theme */
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
|
||||
.fc-state-default.fc-corner-right { /* non-theme */
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
/*
|
||||
Our default prev/next buttons use HTML entities like ‹ › « »
|
||||
and we'll try to make them look good cross-browser.
|
||||
*/
|
||||
|
||||
.fc-text-arrow {
|
||||
margin: 0 .1em;
|
||||
font-size: 2em;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
vertical-align: baseline; /* for IE7 */
|
||||
}
|
||||
|
||||
.fc-button-prev .fc-text-arrow,
|
||||
.fc-button-next .fc-text-arrow { /* for ‹ › */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* icon (for jquery ui) */
|
||||
|
||||
.fc-button .fc-icon-wrap {
|
||||
position: relative;
|
||||
float: left;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.fc-button .ui-icon {
|
||||
position: relative;
|
||||
float: left;
|
||||
margin-top: -50%;
|
||||
*margin-top: 0;
|
||||
*top: -50%;
|
||||
}
|
||||
|
||||
/*
|
||||
button states
|
||||
borrowed from twitter bootstrap (http://twitter.github.com/bootstrap/)
|
||||
*/
|
||||
|
||||
.fc-state-default {
|
||||
background-color: #f5f5f5;
|
||||
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
|
||||
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
color: #333;
|
||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.fc-state-hover,
|
||||
.fc-state-down,
|
||||
.fc-state-active,
|
||||
.fc-state-disabled {
|
||||
color: #333333;
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
|
||||
.fc-state-hover {
|
||||
color: #333333;
|
||||
text-decoration: none;
|
||||
background-position: 0 -15px;
|
||||
-webkit-transition: background-position 0.1s linear;
|
||||
-moz-transition: background-position 0.1s linear;
|
||||
-o-transition: background-position 0.1s linear;
|
||||
transition: background-position 0.1s linear;
|
||||
}
|
||||
|
||||
.fc-state-down,
|
||||
.fc-state-active {
|
||||
background-color: #cccccc;
|
||||
background-image: none;
|
||||
outline: 0;
|
||||
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.fc-state-disabled {
|
||||
cursor: default;
|
||||
background-image: none;
|
||||
opacity: 0.65;
|
||||
filter: alpha(opacity=65);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Global Event Styles
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-event-container > * {
|
||||
z-index: 8;
|
||||
}
|
||||
|
||||
.fc-event-container > .ui-draggable-dragging,
|
||||
.fc-event-container > .ui-resizable-resizing {
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.fc-event {
|
||||
border: 1px solid #3a87ad; /* default BORDER color */
|
||||
background-color: #3a87ad; /* default BACKGROUND color */
|
||||
color: #fff; /* default TEXT color */
|
||||
font-size: .85em;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
a.fc-event {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.fc-event,
|
||||
.fc-event-draggable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.fc-rtl .fc-event {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.fc-event-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fc-event-time,
|
||||
.fc-event-title {
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
.fc .ui-resizable-handle {
|
||||
display: block;
|
||||
position: absolute;
|
||||
z-index: 99999;
|
||||
overflow: hidden; /* hacky spaces (IE6/7) */
|
||||
font-size: 300%; /* */
|
||||
line-height: 50%; /* */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Horizontal Events
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-event-hori {
|
||||
border-width: 1px 0;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
.fc-ltr .fc-event-hori.fc-event-start,
|
||||
.fc-rtl .fc-event-hori.fc-event-end {
|
||||
border-left-width: 1px;
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
|
||||
.fc-ltr .fc-event-hori.fc-event-end,
|
||||
.fc-rtl .fc-event-hori.fc-event-start {
|
||||
border-right-width: 1px;
|
||||
border-top-right-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
|
||||
/* resizable */
|
||||
|
||||
.fc-event-hori .ui-resizable-e {
|
||||
top: 0 !important; /* importants override pre jquery ui 1.7 styles */
|
||||
right: -3px !important;
|
||||
width: 7px !important;
|
||||
height: 100% !important;
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.fc-event-hori .ui-resizable-w {
|
||||
top: 0 !important;
|
||||
left: -3px !important;
|
||||
width: 7px !important;
|
||||
height: 100% !important;
|
||||
cursor: w-resize;
|
||||
}
|
||||
|
||||
.fc-event-hori .ui-resizable-handle {
|
||||
_padding-bottom: 14px; /* IE6 had 0 height */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Reusable Separate-border Table
|
||||
------------------------------------------------------------*/
|
||||
|
||||
table.fc-border-separate {
|
||||
border-collapse: separate;
|
||||
}
|
||||
|
||||
.fc-border-separate th,
|
||||
.fc-border-separate td {
|
||||
border-width: 1px 0 0 1px;
|
||||
}
|
||||
|
||||
.fc-border-separate th.fc-last,
|
||||
.fc-border-separate td.fc-last {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.fc-border-separate tr.fc-last th,
|
||||
.fc-border-separate tr.fc-last td {
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
.fc-border-separate tbody tr.fc-first td,
|
||||
.fc-border-separate tbody tr.fc-first th {
|
||||
border-top-width: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Month View, Basic Week View, Basic Day View
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-grid th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fc .fc-week-number {
|
||||
width: 22px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fc .fc-week-number div {
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.fc-grid .fc-day-number {
|
||||
float: right;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.fc-grid .fc-other-month .fc-day-number {
|
||||
opacity: 0.3;
|
||||
filter: alpha(opacity=30); /* for IE */
|
||||
/* opacity with small font can sometimes look too faded
|
||||
might want to set the 'color' property instead
|
||||
making day-numbers bold also fixes the problem */
|
||||
}
|
||||
|
||||
.fc-grid .fc-day-content {
|
||||
clear: both;
|
||||
padding: 2px 2px 1px; /* distance between events and day edges */
|
||||
}
|
||||
|
||||
/* event styles */
|
||||
|
||||
.fc-grid .fc-event-time {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* right-to-left */
|
||||
|
||||
.fc-rtl .fc-grid .fc-day-number {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.fc-rtl .fc-grid .fc-event-time {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Agenda Week View, Agenda Day View
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-agenda table {
|
||||
border-collapse: separate;
|
||||
}
|
||||
|
||||
.fc-agenda-days th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fc-agenda .fc-agenda-axis {
|
||||
width: 50px;
|
||||
padding: 0 4px;
|
||||
vertical-align: middle;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.fc-agenda .fc-week-number {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fc-agenda .fc-day-content {
|
||||
padding: 2px 2px 1px;
|
||||
}
|
||||
|
||||
/* make axis border take precedence */
|
||||
|
||||
.fc-agenda-days .fc-agenda-axis {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.fc-agenda-days .fc-col0 {
|
||||
border-left-width: 0;
|
||||
}
|
||||
|
||||
/* all-day area */
|
||||
|
||||
.fc-agenda-allday th {
|
||||
border-width: 0 1px;
|
||||
}
|
||||
|
||||
.fc-agenda-allday .fc-day-content {
|
||||
min-height: 34px; /* TODO: doesnt work well in quirksmode */
|
||||
_height: 34px;
|
||||
}
|
||||
|
||||
/* divider (between all-day and slots) */
|
||||
|
||||
.fc-agenda-divider-inner {
|
||||
height: 2px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fc-widget-header .fc-agenda-divider-inner {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
/* slot rows */
|
||||
|
||||
.fc-agenda-slots th {
|
||||
border-width: 1px 1px 0;
|
||||
}
|
||||
|
||||
.fc-agenda-slots td {
|
||||
border-width: 1px 0 0;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.fc-agenda-slots td div {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.fc-agenda-slots tr.fc-slot0 th,
|
||||
.fc-agenda-slots tr.fc-slot0 td {
|
||||
border-top-width: 0;
|
||||
}
|
||||
|
||||
.fc-agenda-slots tr.fc-minor th,
|
||||
.fc-agenda-slots tr.fc-minor td {
|
||||
border-top-style: dotted;
|
||||
}
|
||||
|
||||
.fc-agenda-slots tr.fc-minor th.ui-widget-header {
|
||||
*border-top-style: solid; /* doesn't work with background in IE6/7 */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Vertical Events
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
.fc-event-vert {
|
||||
border-width: 0 1px;
|
||||
}
|
||||
|
||||
.fc-event-vert.fc-event-start {
|
||||
border-top-width: 1px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
|
||||
.fc-event-vert.fc-event-end {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-left-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
|
||||
.fc-event-vert .fc-event-time {
|
||||
white-space: nowrap;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.fc-event-vert .fc-event-inner {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.fc-event-vert .fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
opacity: .25;
|
||||
filter: alpha(opacity=25);
|
||||
}
|
||||
|
||||
.fc .ui-draggable-dragging .fc-event-bg, /* TODO: something nicer like .fc-opacity */
|
||||
.fc-select-helper .fc-event-bg {
|
||||
display: none\9; /* for IE6/7/8. nested opacity filters while dragging don't work */
|
||||
}
|
||||
|
||||
/* resizable */
|
||||
|
||||
.fc-event-vert .ui-resizable-s {
|
||||
bottom: 0 !important; /* importants override pre jquery ui 1.7 styles */
|
||||
width: 100% !important;
|
||||
height: 8px !important;
|
||||
overflow: hidden !important;
|
||||
line-height: 8px !important;
|
||||
font-size: 11px !important;
|
||||
font-family: monospace;
|
||||
text-align: center;
|
||||
cursor: s-resize;
|
||||
}
|
||||
|
||||
.fc-agenda .ui-resizable-resizing { /* TODO: better selector */
|
||||
_overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
6110
js/fullcalendar/fullcalendar.js
Normal file
6110
js/fullcalendar/fullcalendar.js
Normal file
File diff suppressed because it is too large
Load Diff
7
js/fullcalendar/fullcalendar.min.js
vendored
Normal file
7
js/fullcalendar/fullcalendar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
32
js/fullcalendar/fullcalendar.print.css
Normal file
32
js/fullcalendar/fullcalendar.print.css
Normal file
@ -0,0 +1,32 @@
|
||||
/*!
|
||||
* FullCalendar v1.6.4 Print Stylesheet
|
||||
* Docs & License: http://arshaw.com/fullcalendar/
|
||||
* (c) 2013 Adam Shaw
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include this stylesheet on your page to get a more printer-friendly calendar.
|
||||
* When including this stylesheet, use the media='print' attribute of the <link> tag.
|
||||
* Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
|
||||
*/
|
||||
|
||||
|
||||
/* Events
|
||||
-----------------------------------------------------*/
|
||||
|
||||
.fc-event {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
/* for vertical events */
|
||||
|
||||
.fc-event-bg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.fc-event .ui-resizable-handle {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
107
js/fullcalendar/gcal.js
Normal file
107
js/fullcalendar/gcal.js
Normal file
@ -0,0 +1,107 @@
|
||||
/*!
|
||||
* FullCalendar v1.6.4 Google Calendar Plugin
|
||||
* Docs & License: http://arshaw.com/fullcalendar/
|
||||
* (c) 2013 Adam Shaw
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
|
||||
var fc = $.fullCalendar;
|
||||
var formatDate = fc.formatDate;
|
||||
var parseISO8601 = fc.parseISO8601;
|
||||
var addDays = fc.addDays;
|
||||
var applyAll = fc.applyAll;
|
||||
|
||||
|
||||
fc.sourceNormalizers.push(function(sourceOptions) {
|
||||
if (sourceOptions.dataType == 'gcal' ||
|
||||
sourceOptions.dataType === undefined &&
|
||||
(sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) {
|
||||
sourceOptions.dataType = 'gcal';
|
||||
if (sourceOptions.editable === undefined) {
|
||||
sourceOptions.editable = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fc.sourceFetchers.push(function(sourceOptions, start, end) {
|
||||
if (sourceOptions.dataType == 'gcal') {
|
||||
return transformOptions(sourceOptions, start, end);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function transformOptions(sourceOptions, start, end) {
|
||||
|
||||
var success = sourceOptions.success;
|
||||
var data = $.extend({}, sourceOptions.data || {}, {
|
||||
'start-min': formatDate(start, 'u'),
|
||||
'start-max': formatDate(end, 'u'),
|
||||
'singleevents': true,
|
||||
'max-results': 9999
|
||||
});
|
||||
|
||||
var ctz = sourceOptions.currentTimezone;
|
||||
if (ctz) {
|
||||
data.ctz = ctz = ctz.replace(' ', '_');
|
||||
}
|
||||
|
||||
return $.extend({}, sourceOptions, {
|
||||
url: sourceOptions.url.replace(/\/basic$/, '/full') + '?alt=json-in-script&callback=?',
|
||||
dataType: 'jsonp',
|
||||
data: data,
|
||||
startParam: false,
|
||||
endParam: false,
|
||||
success: function(data) {
|
||||
var events = [];
|
||||
if (data.feed.entry) {
|
||||
$.each(data.feed.entry, function(i, entry) {
|
||||
var startStr = entry['gd$when'][0]['startTime'];
|
||||
var start = parseISO8601(startStr, true);
|
||||
var end = parseISO8601(entry['gd$when'][0]['endTime'], true);
|
||||
var allDay = startStr.indexOf('T') == -1;
|
||||
var url;
|
||||
$.each(entry.link, function(i, link) {
|
||||
if (link.type == 'text/html') {
|
||||
url = link.href;
|
||||
if (ctz) {
|
||||
url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (allDay) {
|
||||
addDays(end, -1); // make inclusive
|
||||
}
|
||||
events.push({
|
||||
id: entry['gCal$uid']['value'],
|
||||
title: entry['title']['$t'],
|
||||
url: url,
|
||||
start: start,
|
||||
end: end,
|
||||
allDay: allDay,
|
||||
location: entry['gd$where'][0]['valueString'],
|
||||
description: entry['content']['$t']
|
||||
});
|
||||
});
|
||||
}
|
||||
var args = [events].concat(Array.prototype.slice.call(arguments, 1));
|
||||
var res = applyAll(success, this, args);
|
||||
if ($.isArray(res)) {
|
||||
return res;
|
||||
}
|
||||
return events;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
// legacy
|
||||
fc.gcalFeed = function(url, sourceOptions) {
|
||||
return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' });
|
||||
};
|
||||
|
||||
|
||||
})(jQuery);
|
||||
16
langs/en_US/resource.lang
Executable file
16
langs/en_US/resource.lang
Executable file
@ -0,0 +1,16 @@
|
||||
|
||||
MenuResourceIndex=Resources
|
||||
MenuResourcePlanning=Resource planning
|
||||
DeleteResource=Delete resource
|
||||
ConfirmDeleteResourceElement=Confirm delete the resource for this element
|
||||
|
||||
NoResourceInDatabase=Aucune resource en base de données.
|
||||
NoResourceLinked=No resource linked
|
||||
|
||||
ResourcePageIndex=Resources list
|
||||
|
||||
ResourcesLinkedToElement=Resources linked to element
|
||||
RessourceLineSuccessfullyUpdated=Resource successfully updated
|
||||
RessourceLineSuccessfullyDeleted=Resource successfully deleted
|
||||
|
||||
ShowResourcePlanning=Show resource planning
|
||||
121
resource_planning.php
Normal file
121
resource_planning.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* 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 dev/skeletons/skeleton_page.php
|
||||
* \ingroup mymodule othermodule1 othermodule2
|
||||
* \brief This file is an example of a php page
|
||||
* Put here some comments
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||
$res=0;
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include '../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory
|
||||
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
dol_include_once('/resource/class/resource.class.php');
|
||||
dol_include_once('/resource/class/html.formresource.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
$start = GETPOST('start','int');
|
||||
$end = GETPOST('end','int');
|
||||
$fk_resource = GETPOST('fk_resource','int');
|
||||
|
||||
|
||||
/***************************************************
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
****************************************************/
|
||||
$morecss=array("/resource/js/fullcalendar/fullcalendar.css");
|
||||
|
||||
$morejs=array("/resource/js/fullcalendar/fullcalendar.js");
|
||||
llxHeader('','ResourcePlaning','','','','',$morejs,$morecss,0,0);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
// Put here content of your page
|
||||
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
$("#calendar").fullCalendar({
|
||||
header: {
|
||||
left: \'prev,next today\',
|
||||
center: \'title\',
|
||||
right: \'month,agendaWeek,agendaDay\'
|
||||
},
|
||||
defaultView: \'agendaWeek\',
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
url: "'.dol_buildpath('/resource/core/ajax/resource_action.json.php',1).'",
|
||||
type: "POST",
|
||||
data: {
|
||||
fk_resource: "'.$fk_resource.'"
|
||||
},
|
||||
error: function() {
|
||||
alert("there was an error while fetching events!");
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$formresource = new FormResource($db);
|
||||
|
||||
print $formresource->select_resource_list();
|
||||
|
||||
|
||||
|
||||
print '<div id="calendar"></div>';
|
||||
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
134
resource_timeline.php
Normal file
134
resource_timeline.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* 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 dev/skeletons/skeleton_page.php
|
||||
* \ingroup mymodule othermodule1 othermodule2
|
||||
* \brief This file is an example of a php page
|
||||
* Put here some comments
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||
$res=0;
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include '../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory
|
||||
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
dol_include_once('/resource/class/resource.class.php');
|
||||
dol_include_once('/resource/class/html.formresource.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
$start = GETPOST('start','int');
|
||||
$end = GETPOST('end','int');
|
||||
$fk_resource = GETPOST('fk_resource','int');
|
||||
|
||||
|
||||
/***************************************************
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
****************************************************/
|
||||
$morecss=array("/resource/js/fullcalendar/fullcalendar.css");
|
||||
|
||||
$morejs=array("http://api.simile-widgets.org/timeline/2.3.1/timeline-api.js?bundle=true");
|
||||
llxHeader('','ResourcePlaning','','','','',$morejs,$morecss,0,0);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
// Put here content of your page
|
||||
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
|
||||
|
||||
var tl;
|
||||
function onLoad() {
|
||||
var bandInfos = [
|
||||
Timeline.createBandInfo({
|
||||
width: "70%",
|
||||
intervalUnit: Timeline.DateTime.MONTH,
|
||||
intervalPixels: 100
|
||||
}),
|
||||
Timeline.createBandInfo({
|
||||
width: "30%",
|
||||
intervalUnit: Timeline.DateTime.YEAR,
|
||||
intervalPixels: 200
|
||||
})
|
||||
];
|
||||
tl = Timeline.create(document.getElementById("my-timeline"), bandInfos);
|
||||
}
|
||||
|
||||
var resizeTimerID = null;
|
||||
function onResize() {
|
||||
if (resizeTimerID == null) {
|
||||
resizeTimerID = window.setTimeout(function() {
|
||||
resizeTimerID = null;
|
||||
tl.layout();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
$("body").load( function() { onLoad(); } );
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>';
|
||||
|
||||
$formresource = new FormResource($db);
|
||||
|
||||
print $formresource->select_resource_list();
|
||||
|
||||
|
||||
|
||||
print '<div id="my-timeline" style="height: 350px; border: 1px solid #aaa"></div>
|
||||
<noscript>
|
||||
This page uses Javascript to show you a Timeline. Please enable Javascript in your browser to see the full page. Thank you.
|
||||
</noscript>';
|
||||
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
28
sql/llx_element_resources.sql
Normal file
28
sql/llx_element_resources.sql
Normal file
@ -0,0 +1,28 @@
|
||||
--
|
||||
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
--
|
||||
-- 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/>.
|
||||
|
||||
CREATE TABLE llx_element_resources
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
resource_id integer,
|
||||
resource_type varchar(64),
|
||||
element_id integer,
|
||||
element_type varchar(64),
|
||||
busy integer,
|
||||
mandatory integer,
|
||||
fk_user_create integer,
|
||||
tms timestamp
|
||||
)ENGINE=innodb;
|
||||
Loading…
Reference in New Issue
Block a user