Made the deafult loan length configurable in config.php
This commit is contained in:
parent
d4cf2498fe
commit
16f48cd28d
@ -20,6 +20,9 @@ $language = 'en';
|
|||||||
# Site name
|
# Site name
|
||||||
$name = 'My product tracker';
|
$name = 'My product tracker';
|
||||||
|
|
||||||
|
# Default loan length
|
||||||
|
$default_loan_length = '1 day';
|
||||||
|
|
||||||
# Email subject prefix
|
# Email subject prefix
|
||||||
# Will be prepended without change, so should probably end with a space
|
# Will be prepended without change, so should probably end with a space
|
||||||
$email_subject_prefix = "System name: ";
|
$email_subject_prefix = "System name: ";
|
||||||
|
@ -85,7 +85,7 @@ class CheckoutPage extends Page {
|
|||||||
$email = $this->user->get_email($this->ldap);
|
$email = $this->user->get_email($this->ldap);
|
||||||
$displayname = $this->user->get_displayname($this->ldap);
|
$displayname = $this->user->get_displayname($this->ldap);
|
||||||
$notes = $this->user->get_notes();
|
$notes = $this->user->get_notes();
|
||||||
$enddate = format_date(default_loan_end(time()));
|
$enddate = format_date(default_loan_end());
|
||||||
$disabled = '';
|
$disabled = '';
|
||||||
$loans = $this->user->get_loans('active');
|
$loans = $this->user->get_loans('active');
|
||||||
$loan_table = i18n('No active loans.');
|
$loan_table = i18n('No active loans.');
|
||||||
|
@ -84,7 +84,7 @@ class ProductPage extends Page {
|
|||||||
'service' => i18n('Start service'),
|
'service' => i18n('Start service'),
|
||||||
'history' => $history,
|
'history' => $history,
|
||||||
'attachments' => $attachments,
|
'attachments' => $attachments,
|
||||||
'end' => format_date(default_loan_end(time())));
|
'end' => format_date(default_loan_end()));
|
||||||
if(class_exists('QRcode')) {
|
if(class_exists('QRcode')) {
|
||||||
$fields['label'] = replace($fields,
|
$fields['label'] = replace($fields,
|
||||||
$this->fragments['product_label']);
|
$this->fragments['product_label']);
|
||||||
@ -123,7 +123,7 @@ class ProductPage extends Page {
|
|||||||
$this->fragments['item_link']);
|
$this->fragments['item_link']);
|
||||||
if(!$end) {
|
if(!$end) {
|
||||||
$end = $event->get_endtime();
|
$end = $event->get_endtime();
|
||||||
$extend = format_date(default_loan_end(time()));
|
$extend = format_date(default_loan_end());
|
||||||
$note = replace(array('id' => $product->get_id(),
|
$note = replace(array('id' => $product->get_id(),
|
||||||
'end_new' => $extend),
|
'end_new' => $extend),
|
||||||
$this->fragments['loan_extend_form']);
|
$this->fragments['loan_extend_form']);
|
||||||
|
@ -287,8 +287,12 @@ function format_date($date) {
|
|||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
function default_loan_end($start) {
|
function default_loan_end() {
|
||||||
return $start + 604800; # 1 week later
|
global $default_loan_length;
|
||||||
|
$now = new DateTimeImmutable();
|
||||||
|
$duration = DateInterval::createFromDateString($default_loan_length);
|
||||||
|
$end = $now->add($duration);
|
||||||
|
return $end->getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user