diff --git a/Presenters/Admin/ManageResourcesPresenter.php b/Presenters/Admin/ManageResourcesPresenter.php index 77fddcdfa..8842c4967 100644 --- a/Presenters/Admin/ManageResourcesPresenter.php +++ b/Presenters/Admin/ManageResourcesPresenter.php @@ -978,6 +978,7 @@ public function ImportResource() $resource->SetCheckin($row->checkIn, $row->autoreleaseMinutes); $resource->SetCreditsPerSlot($row->credits); $resource->SetPeakCreditsPerSlot($row->creditsPeak); + $resource->SetMaxConcurrentReservations($row->maximumConcurrent); foreach ($row->attributes as $label => $value) { if (empty($value)) { diff --git a/lang/en_us.php b/lang/en_us.php index d81ccd98c..f8464039d 100755 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -795,6 +795,7 @@ protected function _LoadStrings() $strings['AllowConcurrentReservations'] = 'Allow concurrent reservations'; $strings['ResourceDisplayInstructions'] = 'No resource has been selected. You can find the URL to display a resource in Application Management, Resources. The resource must be publicly accessible.'; $strings['Owner'] = 'Owner'; + $strings['MaximumConcurrentReservations'] = 'Maximum Concurrent Reservations'; // End Strings // Install diff --git a/lib/Application/Admin/ResourceImportCsv.php b/lib/Application/Admin/ResourceImportCsv.php index c67a697c1..6bfdb26d0 100644 --- a/lib/Application/Admin/ResourceImportCsv.php +++ b/lib/Application/Admin/ResourceImportCsv.php @@ -47,6 +47,7 @@ class ResourceImportCsvRow public $autoreleaseMinutes; public $credits; public $creditsPeak; + public $maximumConcurrent; public $attributes = array(); private $values = array(); @@ -89,6 +90,7 @@ public function __construct($values, $indexes, $attributes) $this->autoreleaseMinutes = $this->valueOrDefault('autoreleaseMinutes'); $this->credits = $this->valueOrDefault('credits'); $this->creditsPeak = $this->valueOrDefault('creditsPeak'); + $this->maximumConcurrent = $this->valueOrDefault('concurrentReservations'); foreach ($attributes as $label => $attribute) { @@ -145,6 +147,7 @@ public static function GetHeaders($values, $attributes) $indexes['autoreleaseMinutes'] = self::indexOrFalse('autorelease minutes', $values); $indexes['credits'] = self::indexOrFalse('credits (off peak)', $values); $indexes['creditsPeak'] = self::indexOrFalse('credits (peak)', $values); + $indexes['concurrentReservations'] = self::indexOrFalse('maximum concurrent reservations', $values); foreach ($attributes as $label => $attribute) { diff --git a/lib/Common/Date.php b/lib/Common/Date.php index 055d60075..16275f667 100644 --- a/lib/Common/Date.php +++ b/lib/Common/Date.php @@ -109,35 +109,35 @@ public static function ParseExact($dateString) return NullDate::Instance(); } -/* - * This wasn't producing correct results. - * Parameter $datestring is provided in ISO 8601 format and therefore has the correct timezone - * This then needs to be converted to UTC. - * - $offset = ''; - $strLen = strlen($dateString); - $hourAdjustment = 0; - $minuteAdjustment = 0; - if ($strLen > 5) - { - $offset = substr($dateString, -5); - $hourAdjustment = substr($offset, 1, 2); - $minuteAdjustment = substr($offset, 3, 2); - } - - if (BookedStringHelper::Contains($offset, '+')) - { - $hourAdjustment *= -1; - $minuteAdjustment *= -1; - } - - $parsed = date_parse($dateString); - - $d = Date::Create($parsed['year'], $parsed['month'], $parsed['day'], $parsed['hour'] + $hourAdjustment, $parsed['minute'] + $minuteAdjustment, $parsed['second'], 'UTC'); - */ - - $dt = new DateTime($dateString); - $utc = $dt->setTimezone(new DateTimeZone('UTC')); + /* + * This wasn't producing correct results. + * Parameter $datestring is provided in ISO 8601 format and therefore has the correct timezone + * This then needs to be converted to UTC. + * + $offset = ''; + $strLen = strlen($dateString); + $hourAdjustment = 0; + $minuteAdjustment = 0; + if ($strLen > 5) + { + $offset = substr($dateString, -5); + $hourAdjustment = substr($offset, 1, 2); + $minuteAdjustment = substr($offset, 3, 2); + } + + if (BookedStringHelper::Contains($offset, '+')) + { + $hourAdjustment *= -1; + $minuteAdjustment *= -1; + } + + $parsed = date_parse($dateString); + + $d = Date::Create($parsed['year'], $parsed['month'], $parsed['day'], $parsed['hour'] + $hourAdjustment, $parsed['minute'] + $minuteAdjustment, $parsed['second'], 'UTC'); + */ + + $dt = new DateTime($dateString); + $utc = $dt->setTimezone(new DateTimeZone('UTC')); $d = Date::Create($utc->format('Y'), $utc->format('m'), $utc->format('d'), $utc->format('H'), $utc->format('i'), $utc->format('s'), 'UTC'); @@ -801,24 +801,24 @@ public function Compare(Date $date) } public function LessThan(Date $end) - { - return false; - } - - public function GreaterThan(Date $end) - { - return false; - } - - public function Timestamp() - { - return 0; - } - - public function ToIso() - { - return ''; - } + { + return false; + } + + public function GreaterThan(Date $end) + { + return false; + } + + public function Timestamp() + { + return 0; + } + + public function ToIso() + { + return ''; + } } class DateDiff @@ -1013,7 +1013,7 @@ public function GreaterThan(DateDiff $diff) return $this->seconds > $diff->seconds; } - /** + /** * @param DateDiff $diff * @return bool */ @@ -1030,6 +1030,24 @@ public function Invert() return new DateDiff($this->seconds * -1); } + /** + * @param false $short + * @return string + */ + public function ToString($short = false) + { + if ($short) + { + if ($this->TotalSeconds() > 0) + { + return $this->Days() . 'd' . $this->Hours() . 'h' . $this->Minutes() . 'm'; + } + return ''; + } + + return $this->__toString(); + } + /** * @return string */ diff --git a/lib/Common/TimeInterval.php b/lib/Common/TimeInterval.php index 70c3371b8..0038d3055 100644 --- a/lib/Common/TimeInterval.php +++ b/lib/Common/TimeInterval.php @@ -14,6 +14,7 @@ * You should have received a copy of the GNU General Public License * along with Booked Scheduler. If not, see . */ + class TimeInterval { /** @@ -181,6 +182,23 @@ public function __toString() return ''; } + /** + * @return string + */ + public function ToShortString() + { + if ($this->interval != null) + { + return $this->interval->ToString(true); + } + + return ''; + } + + /** + * @param bool $includeTotalHours + * @return string + */ public function ToString($includeTotalHours) { if ($includeTotalHours) diff --git a/tpl/Admin/Resources/import_resource_template_csv.tpl b/tpl/Admin/Resources/import_resource_template_csv.tpl index 0844b2d9e..3933aa302 100644 --- a/tpl/Admin/Resources/import_resource_template_csv.tpl +++ b/tpl/Admin/Resources/import_resource_template_csv.tpl @@ -1 +1 @@ -name,status,schedule,resource type,sort order,location,contact,description,notes,resource administrator,resource color,reservation minimum length,reservation maximum length,buffer time,reservations can be made across days,resource groups,permission is automatically granted,reservations must be approved,capacity{foreach from=$attributes item=attribute},{$attribute->Label()|escape:'quotes'}{/foreach} \ No newline at end of file +name,status,schedule,resource type,sort order,location,contact,description,notes,resource administrator,resource color,reservation minimum length,reservation maximum length,buffer time,reservations can be made across days,resource groups,permission is automatically granted,reservations must be approved,capacity,requires check in/out,autorelease minutes,credits (off peak),credits (peak),maximum concurrent reservations{foreach from=$attributes item=attribute},{$attribute->Label()|escape:'quotes'}{/foreach} \ No newline at end of file diff --git a/tpl/Admin/Resources/manage_resources.tpl b/tpl/Admin/Resources/manage_resources.tpl index 8f1352f38..5f3f5e749 100644 --- a/tpl/Admin/Resources/manage_resources.tpl +++ b/tpl/Admin/Resources/manage_resources.tpl @@ -508,7 +508,7 @@ along with Booked Scheduler. If not, see .