You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2006-11-07 17:14:48

perexerep
Member
From: The Netherlands
Registered: 2005-08-19
Posts: 22

standard reservation time

Is it possible to add a standard time window in the config database?? Like you have in planning.
The following code worked for me smile, obviously i copy pasted the planning settings.
What failed to achieve is to get the standard minutes, I do not know where adjust those settings.
sql

CREATE TABLE `glpi_config` (

  `planning_begin` time NOT NULL default '08:00:00',
  `planning_end` time NOT NULL default '20:00:00',
  `reservation_begin` time NOT NULL default '09:00:00',
  `reservation_end` time NOT NULL default '19:00:00',
)

reservation.function.php

function showAddReservationForm($target,$ID,$date,$resaID=-1){
    global $cfg_glpi,$lang,$HTMLRel;
    
    if (!haveRight("reservation_helpdesk","1")) return false;

    $resa= new ReservationResa;
    if ($resaID!=-1)
        $resa->getFromDB($resaID);
    else {

    $resa->getEmpty();
        $resa->fields["begin"]=$date.$cfg_glpi["reservation_begin"];
        $resa->fields["end"]=$date.$cfg_glpi["reservation_end"];

config.class.php

        if (isset($input["planning_begin"]))
            $input["planning_begin"]=$input["planning_begin"].":00:00";
        if (isset($input["planning_end"]))
            $input["planning_end"]=$input["planning_end"].":00:00";
        if (isset($input["reservation_begin"]))
            $input["reservation_begin"]=$input["reservation_begin"].":00:00";
        if (isset($input["reservation_end"]))
            $input["reservation_end"]=$input["reservation_end"].":00:00";    
        return $input;

en_GB.php

$lang["setup"][299]="Standard timeframe for resarvations";

setup.function.php

    $reserv_begin=split(":",$cfg_glpi["reservation_begin"]);
    $reserv_end=split(":",$cfg_glpi["reservation_end"]);
    echo "<tr class='tab_bg_2'><td align='center'>".$lang["setup"][299]."</td><td>";
    echo "<select name='reservation_begin'>";
    for ($i=0;$i<=24;$i++) echo "<option value='$i'".($reserv_begin[0]==$i?" selected ":"").">$i</option>";
    echo "</select>";
    echo "&nbsp;->&nbsp;";
    echo "<select name='reservation_end'>";
    for ($i=0;$i<=24;$i++) echo "<option value='$i' ".($reserv_end[0]==$i?" selected ":"").">$i</option>";
    echo "</select>";

PereXereP

Offline

#2 2006-11-07 20:09:07

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: standard reservation time

what do you want to do set the default reservation time to the current day ?


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#3 2006-11-13 15:30:06

perexerep
Member
From: The Netherlands
Registered: 2005-08-19
Posts: 22

Re: standard reservation time

we lend laptops / beamers, mostly per day,
your standard time frame is 12:00-13:00,  i thougt it would be handy to make a global setting in the database.


PereXereP

Offline

Board footer

Powered by FluxBB