Debug module Resource

This commit is contained in:
Laurent Destailleur 2015-11-22 12:23:10 +01:00
parent e438d76df9
commit cb3765bc92
10 changed files with 60 additions and 51 deletions

View File

@ -335,7 +335,7 @@ $tabrowid[29]= "";
// Condition to show dictionary in setup page
$tabcond=array();
$tabcond[1] = true;
$tabcond[1] = (! empty($conf->societe->enabled));
$tabcond[2] = true;
$tabcond[3] = true;
$tabcond[4] = true;
@ -345,7 +345,7 @@ $tabcond[7] = ! empty($conf->tax->enabled);
$tabcond[8] = ! empty($conf->societe->enabled);
$tabcond[9] = true;
$tabcond[10]= true;
$tabcond[11]= true;
$tabcond[11]= (! empty($conf->societe->enabled));
$tabcond[12]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
$tabcond[13]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
$tabcond[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled));

View File

@ -240,14 +240,14 @@ class FormActions
/**
* Output list of type of event
* Output html select list of type of event
*
* @param string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx')
* @param string $htmlname Nom champ formulaire
* @param string $excludetype Type to exclude
* @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
* @param int $hideinfohelp 1=Do not show info help
* @param int $multiselect 1=Allow multiselect of action type for filter or search
* @param int $hideinfohelp 1=Do not show info help
* @param int $multiselect 1=Allow multiselect of action type for filter or search
* @return void
*/
function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0, $multiselect=0)
@ -270,9 +270,10 @@ class FormActions
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']);
if($multiselect==1) {
if ($multiselect==1)
{
if(!is_array($selected) && !empty($selected)) $selected = explode(',', $selected);
print $form->multiselectarray($htmlname, $arraylist,$selected,0, 0, '', 0, 200);
print $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, '', 0, 0);
}
else {

View File

@ -82,14 +82,16 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
// Type
print '<tr>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("Type");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
//select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0, $multiselect=true)
print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 0, 1);
print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), 0, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?0:1));
print '</td></tr>';
// Status
print '<tr>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("Status");

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -153,10 +154,6 @@ class modResource extends DolibarrModules
// '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(
// 'thirdparty:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=societe&element_id=__ID__'
);
// Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
$this->boxes = array(); // Boxes list
@ -250,6 +247,21 @@ class modResource extends DolibarrModules
'user'=> 0
);
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus
'type'=> 'left', // Toujours un menu gauche
'titre'=> 'List',
'mainmenu'=> 'tools',
'leftmenu'=> '', // On n'indique rien ici car on ne souhaite pas intégrer de sous-menus à ce menu
'url'=> '/resource/list.php',
'langs'=> 'resource',
'position'=> 102,
'enabled'=> '1',
'perms'=> '$user->rights->resource->read',
'target'=> '',
'user'=> 0
);
// Exports
$r = 1;

View File

@ -1,7 +1,6 @@
<!-- BEGIN TEMPLATE resource_add.tpl.php -->
<?php
// BEGIN TPL RESOURCE_ADD.TPL.PHP
require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
$form = new Form($db);
@ -23,8 +22,8 @@ $events=array();
$out .= $formresources->select_resource_list('','fk_resource','',1,1,0,$events,'',2);
$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('Mandatory').'</label> '.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy',(isset($_POST['busy'])?$_POST['busy']:1),1).'</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Mandatory').'</label> '.$form->selectyesno('mandatory',(isset($_POST['mandatory'])?$_POST['mandatory']:0),1).'</div>';
$out .= '<div class="tagtd" align="right">';
$out .='<input type="submit" id="add-resource-place" class="button" value="'.$langs->trans("Add").'"/>';
@ -33,8 +32,8 @@ $out .= '</div>';
$out .='</form>';
$out .= '</div>';
$out .= '<br />';
$out .= '<br>';
print $out;
// END BEGIN TPL RESOURCE_ADD.TPL.PHP
?>
<!-- END TEMPLATE resource_add.tpl.php -->

View File

@ -1,3 +1,4 @@
<!-- BEGIN TEMPLATE resource_view.tpl.php -->
<?php
//var_dump($linked_resources);
@ -8,30 +9,27 @@ if( (array) $linked_resources && count($linked_resources) > 0)
{
$var=true;
// TODO: DEBUT DU TPL
print '<div class="tagtable centpercent noborder allwidth">';
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('Type').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd"></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('Type').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd"></div>';
print '</form>';
//print '</div>';
}
@ -49,11 +47,11 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
print '<div class="tagtd">'.$object_resource->type_label.'</div>';
print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
print '<div class="tagtd">'.$object_resource->type_label.'</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"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
print '<div class="tagtd" align="center">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
print '<div class="tagtd" align="right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
print '</form>';
}
@ -65,14 +63,14 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '<div class="tagtr '.($var==true?"pair":"impair").'" '.$style.'>';
print '<div class="tagtd">';
print $object_resource->type_label;
print '</div>';
print '<div class="tagtd">';
print $object_resource->getNomUrl(1);
print '</div class="tagtd">';
print '<div class="tagtd">';
print $object_resource->type_label;
print '</div>';
print '<div class="tagtd" align="center">';
print yn($linked_resource['busy']);
print '</div>';
@ -96,14 +94,12 @@ if( (array) $linked_resources && count($linked_resources) > 0)
}
print '</div>';
}
else {
print '<div class="warning">'.$langs->trans('NoResourceLinked').'</div>';
}
// FIN DU TPL
?>
<!-- END TEMPLATE resource_view.tpl.php -->

View File

@ -17,6 +17,7 @@ ResourceFormLabel_description=Resource description
ResourcesLinkedToElement=Resources linked to element
ShowResource=Show resource
ShowResourcePlanning=Show resource planning
GotoDate=Go to date

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -111,9 +112,9 @@ if ($action == 'confirm_add_resource')
}
}
/*
* View
*
*/
$form=new Form($db);
@ -146,7 +147,7 @@ if (! $action)
// Type
print '<tr><td width="20%">'.$langs->trans("ResourceType").'</td>';
print '<td>';
$ret = $formresource->select_types_resource($object->fk_code_type_resource,'fk_code_type_resource','',2);
$ret = $formresource->select_types_resource($object->fk_code_type_resource, 'fk_code_type_resource', '', 2, 1);
print '</td></tr>';
// Description
@ -168,7 +169,7 @@ if (! $action)
echo '<div align="center">',
'<input type="submit" class="button" name="add" value="'.$langs->trans('Save').'" />',
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
' &nbsp; ',
'<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" />',
'</div>';

View File

@ -79,7 +79,7 @@ class Resource extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
$sql.= " entity,";
$sql.= "entity,";
$sql.= "ref,";
$sql.= "description,";
$sql.= "fk_code_type_resource,";

View File

@ -2606,6 +2606,7 @@ div.ok {
color: #114466;
}
/* Warning message */
div.warning {
color: #302020;
padding: 0.3em 0.3em 0.3em 0.3em;
@ -2618,14 +2619,7 @@ div.warning {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
div.error {
color: #550000; font-weight: bold;
padding: 0.3em 0.3em 0.3em 0.3em;
margin: 0.5em 0em 0.5em 0em;
border: 1px solid #DC9CAB;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
/* Error message */
background: #EFCFCF;
}
@ -2642,6 +2636,9 @@ div.info {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
div.warning a, div.info a, div.error a {
color: rgb(<?php echo $colortext; ?>);
}
/*
* Liens Payes/Non payes