Moved Invoice reminders into Minion Tasks

This commit is contained in:
Deon George
2013-07-05 23:37:06 +10:00
parent f3d2c1fe8d
commit 0a0e149e56
10 changed files with 124 additions and 71 deletions

View File

@@ -464,19 +464,22 @@ class Model_Invoice extends ORM_OSB implements Cartable {
}
public function set_remind($key,$value,$add=FALSE) {
$x = $this->reminders;
// If our value is null, we'll remove it.
if (is_null($value) AND isset($this->reminders[$key]))
unset($this->reminders[$key]);
if (is_null($value) AND isset($x[$key]))
unset($x[$key]);
elseif ($add) {
if (! is_array($a=$this->reminders[$key]))
$this->reminders[$key] = array($a);
if (! is_array($a=$x[$key]))
$x[$key] = array($a);
$this->reminders[$key][] = $value;
$x[$key][] = $value;
} else
$this->reminders[$key] = $value;
$x[$key] = $value;
$this->reminders = $x;
$this->save();
return $this->saved();