Little debug of module resource

This commit is contained in:
Laurent Destailleur 2015-05-31 02:05:39 +02:00
parent 5e773d4cb6
commit 49f2157f2d
9 changed files with 94 additions and 79 deletions

View File

@ -1267,7 +1267,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1276,7 +1276,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1285,7 +1285,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1294,7 +1294,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</div>'; print '</div>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
@ -143,7 +143,7 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>';
// Full day event // Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent).'</td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
// Date start // Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
@ -235,7 +235,7 @@ if ($object->id > 0)
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Project").'</td><td colspan="3">';
if ($object->fk_project) if ($object->fk_project)
{ {
$project=new Project($db); $project=new Project($db);
@ -274,7 +274,7 @@ if ($object->id > 0)
} }
print '<tr><td width="30%" nowrap>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td width="30%" class="nowrap">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
@ -294,7 +294,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -303,7 +303,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -312,7 +312,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -321,7 +321,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</div>'; print '</div>';

View File

@ -421,6 +421,15 @@ function actions_prepare_head($object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
// Tab to link resources
if ($conf->resource->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
$h++;
}
// Attached files // Attached files
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->agenda->dir_output . "/" . $object->id; $upload_dir = $conf->agenda->dir_output . "/" . $object->id;

View File

@ -93,6 +93,15 @@ function societe_prepare_head(Societe $object)
$h++; $h++;
} }
// Tab to link resources
if ($conf->resource->enabled && ! empty($conf->global->RESOURCE_ON_THIRDPARTIES))
{
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=societe&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
$h++;
}
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -1,6 +1,5 @@
<?php <?php
/* Module to manage resources into Dolibarr ERP/CRM /* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2013-2014 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
@ -14,6 +13,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Module to manage resources into Dolibarr ERP/CRM
*/ */
/** /**
@ -151,8 +152,7 @@ class modResource extends DolibarrModules
// (reresource 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // (reresource 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
$this->tabs = array( $this->tabs = array(
'action:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=action&element_id=__ID__', // 'thirdparty:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=societe&element_id=__ID__'
'thirdparty:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=societe&element_id=__ID__'
); );
// Boxes // Boxes

View File

@ -1,14 +1,13 @@
<?php <?php
// BEGIN TPL RESOURCE_ADD.TPL.PHP
//$langs->load($resource_type); require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
$form = new Form($db); $form = new Form($db);
if(!class_exists('FormResource'))
require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
$formresources = new FormResource($db); $formresources = new FormResource($db);
$out .= '<div class="tagtable centpercent border allwidth">'; $out .= '<div class="tagtable centpercent border allwidth nohover">';
$out .= '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $out .= '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -27,10 +26,8 @@ $out .= '</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>'; $out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Mandatory').'</label> '.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>'; $out .= '<div class="tagtd"><label>'.$langs->trans('Mandatory').'</label> '.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
$out .= '<div class="tagtd">'; $out .= '<div class="tagtd" align="right">';
$out .='<input type="submit" id="add-resource-place" class="button" value="'.$langs->trans("Add").'"'; $out .='<input type="submit" id="add-resource-place" class="button" value="'.$langs->trans("Add").'"/>';
$out .=' />';
$out .='<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'" />';
$out .= '</div>'; $out .= '</div>';
$out .='</form>'; $out .='</form>';
@ -40,6 +37,4 @@ $out .= '<br />';
print $out; print $out;
// FIN DU TPL // FIN DU TPL

View File

@ -6,36 +6,32 @@ $form= new Form($db);
if( (array) $linked_resources && count($linked_resources) > 0) if( (array) $linked_resources && count($linked_resources) > 0)
{ {
$var=false; $var=true;
// TODO: DEBUT DU TPL // TODO: DEBUT DU TPL
if($mode == 'edit' ) if($mode == 'edit' )
{ {
print '<div class="tagtable centpercent noborder allwidth">'; print '<div class="tagtable centpercent noborder allwidth">';
print '<form class="tagtr liste_titre">'; print '<form class="tagtr liste_titre">';
print '<div class="tagtd">'.$langs->trans('Type').'</div>'; print '<div class="tagtd">'.$langs->trans('Type').'</div>';
print '<div class="tagtd">'.$langs->trans('Resource').'</div>'; print '<div class="tagtd">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd">'.$langs->trans('Busy').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd">'.$langs->trans('Mandatory').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd">'.$langs->trans('Edit').'</div>'; print '<div class="tagtd"></div>';
print '</form>'; print '</form>';
//print '</div>'; //print '</div>';
} }
else else
{ {
print '<div class="tagtable centpercent noborder allwidth">'; print '<div class="tagtable centpercent noborder allwidth">';
print '<form class="tagtr liste_titre">'; print '<form class="tagtr liste_titre">';
print '<div class="tagtd">'.$langs->trans('Type').'</div>'; print '<div class="tagtd">'.$langs->trans('Type').'</div>';
print '<div class="tagtd">'.$langs->trans('Resource').'</div>'; print '<div class="tagtd">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd">'.$langs->trans('Busy').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd">'.$langs->trans('Mandatory').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd">'.$langs->trans('Action').'</div>'; print '<div class="tagtd"></div>';
print '</form>'; print '</form>';
//print '</div>'; //print '</div>';
} }
@ -55,7 +51,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '<div class="tagtd">'.$object_resource->type_label.'</div>'; print '<div class="tagtd">'.$object_resource->type_label.'</div>';
print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</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" align="center">'.$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">'.$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 '<div class="tagtd"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
print '</form>'; print '</form>';
@ -77,15 +73,15 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print $object_resource->getNomUrl(1); print $object_resource->getNomUrl(1);
print '</div class="tagtd">'; print '</div class="tagtd">';
print '<div class="tagtd">'; print '<div class="tagtd" align="center">';
print $linked_resource['busy']?1:0; print yn($linked_resource['busy']);
print '</div>'; print '</div>';
print '<div class="tagtd">'; print '<div class="tagtd" align="center">';
print $linked_resource['mandatory']?1:0; print yn($linked_resource['mandatory']);
print '</div>'; print '</div>';
print '<div class="tagtd">'; print '<div class="tagtd" align="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">'; print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';

View File

@ -72,6 +72,11 @@ $mandatory = GETPOST('mandatory','int');
$cancel = GETPOST('cancel','alpha'); $cancel = GETPOST('cancel','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
/*
* Actions
*/
if($action == 'add_element_resource' && ! $cancel) if($action == 'add_element_resource' && ! $cancel)
{ {
$objstat = fetchObjectByElement($element_id,$element); $objstat = fetchObjectByElement($element_id,$element);
@ -147,19 +152,17 @@ $reshook=$hookmanager->executeHooks('getElementResources',$parameters,$object,$a
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/***************************************************
* VIEW /*
* * View
* Put here all code to build page */
****************************************************/
$form=new Form($db);
$pagetitle=$langs->trans('ResourceElementPage'); $pagetitle=$langs->trans('ResourceElementPage');
llxHeader('',$pagetitle,''); llxHeader('',$pagetitle,'');
$form=new Form($db);
// Load available resource, declared by modules // Load available resource, declared by modules
$ret = count($object->available_resources); $ret = count($object->available_resources);
if($ret == -1) { if($ret == -1) {
@ -212,16 +215,17 @@ else
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; dol_fiche_end();
} }
} }
/* /*
* Specific to thirdparty module * Specific to thirdparty module
*/ */
if($element_id && $element == 'societe') if ($element_id && $element == 'societe')
{ {
$socstatic = fetchObjectByElement($element_id,$element); $socstatic = fetchObjectByElement($element_id,$element);
if(is_object($socstatic)) { if (is_object($socstatic)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$head = societe_prepare_head($socstatic); $head = societe_prepare_head($socstatic);
@ -240,13 +244,13 @@ else
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</div>'; dol_fiche_end();
} }
} }
print_fiche_titre($langs->trans('ResourcesLinkedToElement'),'','resource.png@resource'); //print_fiche_titre($langs->trans('ResourcesLinkedToElement'),'','');
@ -257,7 +261,8 @@ else
{ {
$element_prop = getElementProperties($resource_obj); $element_prop = getElementProperties($resource_obj);
print_titre($langs->trans(ucfirst($element_prop['element']).'Singular'));
//print '/'.$modresources.'/class/'.$resource_obj.'.class.php<br />'; //print '/'.$modresources.'/class/'.$resource_obj.'.class.php<br />';
@ -267,21 +272,21 @@ else
$linked_resources = $object->getElementResources($element,$element_id,$resource_obj); $linked_resources = $object->getElementResources($element,$element_id,$resource_obj);
if ( $mode == 'add' && $resource_obj == $resource_type)
// If we have a specific template we use it
if(file_exists(dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php')))
{ {
// If we have a specific template we use it $res=include dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php');
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_DOCUMENT_ROOT . '/core/tpl/resource_add.tpl.php';
}
} }
else else
{ {
//print '/'.$element_prop['module'].'/core/tpl/resource_'.$element_prop['element'].'_view.tpl.php'; $res=include DOL_DOCUMENT_ROOT . '/core/tpl/resource_add.tpl.php';
}
if ($mode != 'add' || $resource_obj != $resource_type)
{
//print_titre($langs->trans(ucfirst($element_prop['element']).'Singular'));
// If we have a specific template we use it // If we have a specific template we use it
if(file_exists(dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_view.tpl.php'))) if(file_exists(dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_view.tpl.php')))
@ -294,15 +299,6 @@ else
$res=include DOL_DOCUMENT_ROOT . '/core/tpl/resource_view.tpl.php'; $res=include DOL_DOCUMENT_ROOT . '/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.'">'.$langs->trans('AddResource').'</a>';
print '</div>';
print '</div>';
}
} }
} }
} }

View File

@ -448,7 +448,17 @@ textarea.centpercent {
#formuserfile_link { #formuserfile_link {
margin-left: 1px; margin-left: 1px;
} }
/* Style to move picto into left of button */
/*
.buttonactionview {
padding-left: 15px;
}
.pictoactionview {
padding-left: 10px;
margin-right: -24px;
z-index: 999999;
}
*/
/* ============================================================================== */ /* ============================================================================== */
/* Styles to hide objects */ /* Styles to hide objects */