Replace reserved keyword "Resource" by "DolResource"

# Conflicts:
#	htdocs/resource/list.php
This commit is contained in:
jfefe 2016-01-21 11:18:29 +01:00
parent c0515a469d
commit 7c4a9d140b
8 changed files with 362 additions and 339 deletions

View File

@ -1882,6 +1882,11 @@ function getElementProperties($element_type)
$module='ficheinter'; $module='ficheinter';
$subelement='fichinter'; $subelement='fichinter';
} }
if ($element_type == 'dolresource') {
$classpath = 'resource/class';
$module='resource';
$subelement='dolresource';
}
$classfile = strtolower($subelement); $classfile = strtolower($subelement);
$classname = ucfirst($subelement); $classname = ucfirst($subelement);

View File

@ -13,7 +13,7 @@ $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<input type="hidden" name="action" value="add_element_resource">'; $out .= '<input type="hidden" name="action" value="add_element_resource">';
$out .= '<input type="hidden" name="element" value="'.$element.'">'; $out .= '<input type="hidden" name="element" value="'.$element.'">';
$out .= '<input type="hidden" name="element_id" value="'.$element_id.'">'; $out .= '<input type="hidden" name="element_id" value="'.$element_id.'">';
$out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'resource' : $resource_type).'">'; $out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'dolresource' : $resource_type).'">';
// Place // Place

View File

@ -21,12 +21,11 @@
* \file resource/add.php * \file resource/add.php
* \ingroup resource * \ingroup resource
* \brief Page to manage resource object * \brief Page to manage resource object
* Initialy built by build_class_from_table on 2013-07-24 16:03
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/resource.class.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
// Load traductions files required by page // Load traductions files required by page
@ -59,7 +58,7 @@ if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
} }
$object = new Resource($db); $object = new DolResource($db);
if ($action == 'confirm_add_resource') if ($action == 'confirm_add_resource')
{ {
@ -80,7 +79,7 @@ if ($action == 'confirm_add_resource')
if (! $error) if (! $error)
{ {
$object=new Resource($db); $object=new Dolresource($db);
$object->ref=$ref; $object->ref=$ref;
$object->description=$description; $object->description=$description;
$object->fk_code_type_resource=$fk_code_type_resource; $object->fk_code_type_resource=$fk_code_type_resource;

View File

@ -29,7 +29,7 @@ if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory
if (! $res) die("Include of main fails"); if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once 'class/resource.class.php'; require_once 'class/dolresource.class.php';
require_once 'class/html.formresource.class.php'; require_once 'class/html.formresource.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
@ -56,7 +56,7 @@ if ($user->societe_id > 0)
if( ! $user->rights->resource->read) if( ! $user->rights->resource->read)
accessforbidden(); accessforbidden();
$object = new Resource($db); $object = new Dolresource($db);
$hookmanager->initHooks(array('resource_card','globalcard')); $hookmanager->initHooks(array('resource_card','globalcard'));
$parameters=array('resource_id'=>$id); $parameters=array('resource_id'=>$id);

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2013-2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php";
/** /**
* DAO Resource object * DAO Resource object
*/ */
class Resource extends CommonObject class Dolresource extends CommonObject
{ {
var $element='resource'; //!< Id that identify managed objects var $element='resource'; //!< Id that identify managed objects
var $table_element='resource'; //!< Name of table without prefix where object is stored var $table_element='resource'; //!< Name of table without prefix where object is stored
@ -414,7 +414,7 @@ class Resource extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$line = new Resource($this->db); $line = new Dolresource($this->db);
$line->id = $obj->rowid; $line->id = $obj->rowid;
$line->ref = $obj->ref; $line->ref = $obj->ref;
$line->description = $obj->description; $line->description = $obj->description;
@ -488,7 +488,7 @@ class Resource extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$line = new Resource($this->db); $line = new Dolresource($this->db);
$line->id = $obj->rowid; $line->id = $obj->rowid;
$line->resource_id = $obj->resource_id; $line->resource_id = $obj->resource_id;
$line->resource_type = $obj->resource_type; $line->resource_type = $obj->resource_type;
@ -574,7 +574,7 @@ class Resource extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$line = new Resource($this->db); $line = new Dolresource($this->db);
$line->id = $obj->rowid; $line->id = $obj->rowid;
$line->resource_id = $obj->resource_id; $line->resource_id = $obj->resource_id;
$line->resource_type = $obj->resource_type; $line->resource_type = $obj->resource_type;

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) - 2013 Jean-François FERRY <jfefe@aternatik.fr> /* Copyright (C) - 2013-2015 Jean-François FERRY <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
*/ */
/** /**
* \file place/class/html.place.class.php * \file place/class/html.formresource.class.php
* \ingroup core * \ingroup core
* \brief Class file to manage forms into resource module * \brief Class file to manage forms into resource module
*/ */
@ -75,7 +75,7 @@ class FormResource
$out=''; $out='';
$outarray=array(); $outarray=array();
$resourcestat = new Resource($this->db); $resourcestat = new Dolresource($this->db);
$resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, $offset, $filter=''); $resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, $offset, $filter='');
@ -159,7 +159,7 @@ class FormResource
{ {
global $langs,$user; global $langs,$user;
$resourcestat = new Resource($this->db); $resourcestat = new Dolresource($this->db);
dol_syslog(get_class($this)."::select_types_resource ".$selected.", ".$htmlname.", ".$filtertype.", ".$format,LOG_DEBUG); dol_syslog(get_class($this)."::select_types_resource ".$selected.", ".$htmlname.", ".$filtertype.", ".$format,LOG_DEBUG);

View File

@ -27,7 +27,7 @@ $res=@include("../main.inc.php"); // For root directory
if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory
if (! $res) die("Include of main fails"); if (! $res) die("Include of main fails");
require 'class/resource.class.php'; require 'class/dolresource.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load traductions files requiredby by page // Load traductions files requiredby by page
@ -43,10 +43,10 @@ $page = GETPOST('page','int');
if( ! $user->rights->resource->read) if( ! $user->rights->resource->read)
accessforbidden(); accessforbidden();
$object=new Resource($db); $object=new Dolresource($db);
$hookmanager->initHooks(array('element_resource')); $hookmanager->initHooks(array('element_resource'));
$object->available_resources = array('resource'); $object->available_resources = array('dolresource');
// Get parameters // Get parameters
$id = GETPOST('id','int'); $id = GETPOST('id','int');

View File

@ -23,9 +23,9 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/resource.class.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
// Load translations files requiredby by page // Load translations files required by page
$langs->load("resource"); $langs->load("resource");
$langs->load("companies"); $langs->load("companies");
$langs->load("other"); $langs->load("other");
@ -43,7 +43,7 @@ $sortorder = GETPOST('sortorder','alpha');
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
$object = new Resource($db); $object = new Dolresource($db);
$hookmanager->initHooks(array('resource_list')); $hookmanager->initHooks(array('resource_list'));
@ -149,9 +149,28 @@ else
} }
/*
* Boutons actions
*/
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook))
{
if ($action != "edit" )
{
// Edit resource
if($user->rights->resource->write)
{
print '<div class="inline-block divButAction">';
print '<a href="add.php" class="butAction">'.$langs->trans('AddResource').'</a>';
print '</div>';
}
}
}
print '</div>';
llxFooter(); llxFooter();
$db->close(); $db->close();