Misc fixes from live site
This commit is contained in:
@@ -419,19 +419,8 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
* Check the reminder value
|
||||
*/
|
||||
public function remind($key) {
|
||||
if (! $this->loaded())
|
||||
return NULL;
|
||||
|
||||
if (! trim($this->reminders))
|
||||
return FALSE;
|
||||
|
||||
if (! preg_match('/^a:/',$this->reminders))
|
||||
throw new Kohana_Exception('Reminder is not an array? (:reminder)',array(':remind',$this->reminders));
|
||||
|
||||
$remind = unserialize($this->reminders);
|
||||
|
||||
if (isset($remind[$key]))
|
||||
return (is_array($remind[$key])) ? end($remind[$key]) : $remind[$key];
|
||||
if (isset($this->reminders[$key]))
|
||||
return (is_array($this->reminders[$key])) ? end($this->reminders[$key]) : $this->reminders[$key];
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
@@ -475,33 +464,21 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
}
|
||||
|
||||
public function set_remind($key,$value,$add=FALSE) {
|
||||
if (! $this->loaded())
|
||||
throw new Kohana_Exception('Cant call :method when a record not loaded.',array(':method',__METHOD__));
|
||||
|
||||
if (! trim($this->reminders)) {
|
||||
$remind = array();
|
||||
|
||||
} else {
|
||||
if (! preg_match('/^a:/',$this->reminders))
|
||||
throw new Kohana_Exception('Reminder is not an array? (:reminder)',array(':remind',$this->reminders));
|
||||
|
||||
$remind = unserialize($this->reminders);
|
||||
}
|
||||
|
||||
// If our value is null, we'll remove it.
|
||||
if (is_null($value) AND isset($remind[$key]))
|
||||
unset($remind[$key]);
|
||||
elseif ($add) {
|
||||
if (! is_array($a=$remind[$key]))
|
||||
$remind[$key] = array($a);
|
||||
if (is_null($value) AND isset($this->reminders[$key]))
|
||||
unset($this->reminders[$key]);
|
||||
|
||||
$remind[$key][] = $value;
|
||||
elseif ($add) {
|
||||
if (! is_array($a=$this->reminders[$key]))
|
||||
$this->reminders[$key] = array($a);
|
||||
|
||||
$this->reminders[$key][] = $value;
|
||||
|
||||
} else
|
||||
$remind[$key] = $value;
|
||||
$this->reminders[$key] = $value;
|
||||
|
||||
$this->reminders = serialize($remind);
|
||||
$this->save();
|
||||
|
||||
return $this->saved();
|
||||
}
|
||||
|
||||
|
@@ -54,7 +54,8 @@
|
||||
<?php if ($iio->service_id) : ?>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th colspan="2"><?php echo HTML::anchor(URL::link('user','service/view/'.$iio->service_id),$iio->service->id()).' '.$iio->service->service_name(); ?></th>
|
||||
<!-- @todo product->title() should be changed to show the service_name() for the invoice product item -->
|
||||
<th colspan="2"><?php echo HTML::anchor(URL::link('user','service/view/'.$iio->service_id),$iio->service->id()).' '.$iio->product->title(); ?></th>
|
||||
<th> </th>
|
||||
<th><div class="text-right"><?php echo $o->service_items_total($iio,TRUE); ?></div></th>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user